Automattic\WooCommerce\Internal\MCP

McpEndpointRemoval::get_adapter_link_type │ private │ WC 1.0

Decide which MCP Adapter link the removal notice shows to the current user.

No link is shown when an MCP adapter is already loaded, from the MCP Adapter plugin or any other plugin.

Метод класса: McpEndpointRemoval{}

Хуков нет.

Возвращает

string. 'install', 'activate', or '' for no link.

Использование

// private - только в коде основоного (родительского) класса
$result = $this->get_adapter_link_type(): string;

Код McpEndpointRemoval::get_adapter_link_type() WC 11.3.0

private function get_adapter_link_type(): string {
	if ( self::is_mcp_adapter_available() ) {
		return '';
	}

	$proxy = wc_get_container()->get( LegacyProxy::class );
	if ( $proxy->call_function( 'file_exists', WP_PLUGIN_DIR . '/' . self::ADAPTER_PLUGIN_FILE ) ) {
		return current_user_can( 'activate_plugins' ) ? 'activate' : '';
	}

	return current_user_can( 'install_plugins' ) ? 'install' : '';
}