Utilities::automator_get_integration_icon( string $file_name,  $plugin_path = AUTOMATOR_BASE_FILE )

Returns the full url for the passed Icon within recipe UI


Parameters Parameters

$file_name

(string) (Required)


Top ↑

Return Return

(string) $asset_url


Source Source

File: src/core/class-utilities.php

	public static function automator_get_integration_icon( $file_name, $plugin_path = AUTOMATOR_BASE_FILE ) {
		/**
		 * Integration icons are now moved in to integrations itself
		 * @since 3.0
		 */
		if ( ! empty( $file_name ) && is_dir( dirname( $file_name, 1 ) ) ) {
			$icon            = basename( $file_name ); // icon with extension.
			$integration_dir = basename( dirname( $file_name, 2 ) ); // integration folder path.
			$path            = self::cleanup_icon_path( AUTOMATOR_BASE_FILE, $icon, $file_name ); // path relative to plugin.
			$path            = apply_filters( 'automator_integration_icon_path', $path . $icon, $icon, $integration_dir, $plugin_path );
			$base_path       = apply_filters( 'automator_integration_icon_base_path', $plugin_path, $path, $icon, $integration_dir );

			return plugins_url( $path, $base_path );
		}

		// fallback
		$path      = apply_filters( 'automator_integration_icon_path_legacy', 'src/recipe-ui/dist/media/integrations/' . $file_name, $file_name, $plugin_path );
		$base_path = apply_filters( 'automator_integration_icon_base_path_legacy', WP_CONTENT_DIR . DIRECTORY_SEPARATOR . 'plugins' . DIRECTORY_SEPARATOR . $plugin_path, $file_name );

		return plugins_url( $path, $base_path );
	}


Top ↑

Changelog Changelog

Changelog
Version Description
1.0.0 Introduced.