Automattic\WooCommerce\Internal\MCP
McpEndpointRemoval::get_adapter_link_type
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.
Method of the class: McpEndpointRemoval{}
No Hooks.
Returns
string. 'install', 'activate', or '' for no link.
Usage
// private - for code of main (parent) class only $result = $this->get_adapter_link_type(): string;
McpEndpointRemoval::get_adapter_link_type() McpEndpointRemoval::get adapter link type code 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' : '';
}