Filter uncanny-automator

automator_mcp_client_sdk_css_url

Filters the API client SDK CSS URL before it's loaded.

add_filter( 'automator_mcp_client_sdk_css_url', $callback, 10, 1 );

Description

Filters the URL for the Motor Control Panel client SDK's CSS file. Developers can modify this URL to point to a custom CSS file for the SDK, allowing for complete styling control. This hook fires just before the SDK's CSS is enqueued.


Usage

add_filter( 'automator_mcp_client_sdk_css_url', 'your_function_name', 10, 1 );

Parameters

$url (mixed)
This parameter contains the URL of the CSS file for the client SDK, which can be filtered to change the default URL.

Return Value

The filtered value.


Examples

/**
 * Modify the SDK CSS URL to load a custom stylesheet from our CDN for faster loading.
 *
 * @param string $url The original SDK CSS URL.
 * @return string The modified SDK CSS URL.
 */
add_filter( 'automator_mcp_client_sdk_css_url', function( $url ) {
    // Check if we have a custom CDN URL defined.
    if ( defined( 'MY_CUSTOM_CDN_URL' ) && MY_CUSTOM_CDN_URL ) {
        // Construct the URL to our custom CSS file.
        $custom_css_url = trailingslashit( MY_CUSTOM_CDN_URL ) . 'assets/css/automator-mcp-sdk.css';
        return $custom_css_url;
    }

    // If no custom CDN is defined, return the original URL.
    return $url;
}, 10, 1 );

Placement

This code should be placed in the functions.php file of your active theme, a custom plugin, or using a code snippets plugin.


Source Code

src/api/application/mcp/class-mcp-client.php:594

private function get_sdk_css_url(): string {
		$url = defined( 'AUTOMATOR_MCP_CLIENT_SDK_CSS_URL' ) && AUTOMATOR_MCP_CLIENT_SDK_CSS_URL
			? AUTOMATOR_MCP_CLIENT_SDK_CSS_URL
			: self::SDK_CSS_URL;

		return apply_filters( 'automator_mcp_client_sdk_css_url', $url );
	}


Scroll to Top