PHP Class Themosis\Asset\AssetFactory

显示文件 Open project: themosis/framework

Protected Properties

Property Type Description
$aliasPrefix string Alias prefix in order to register assets into the service container.
$allowedAssets array A list of authorized assets to add.
$container Themosis\Foundation\Application The service container.
$finder AssetFinder The AssetFinder instance.

Public Methods

Method Description
__construct ( AssetFinder $finder, Application $container ) Constructor.
add ( string $handle, string $path, array | boolean $deps = [], string $version = '1.0', boolean | string $mixed = null, string $type = '' ) : Asset | WP_Error Add an asset to the application.

Method Details

__construct() public method

Constructor.
public __construct ( AssetFinder $finder, Application $container )
$finder AssetFinder
$container Themosis\Foundation\Application

add() public method

NOTE : By default the path is relative to one of the registered paths. Make sure your asset is unique by handle and paths/url. You can also pass an external url.
public add ( string $handle, string $path, array | boolean $deps = [], string $version = '1.0', boolean | string $mixed = null, string $type = '' ) : Asset | WP_Error
$handle string The asset handle name.
$path string The URI to the asset or the absolute URL.
$deps array | boolean An array with asset dependencies or false.
$version string The version of your asset.
$mixed boolean | string Boolean if javascript file | String if stylesheet file.
$type string 'script' or 'style'.
return Asset | WP_Error

Property Details

$aliasPrefix protected_oe property

Alias prefix in order to register assets into the service container.
protected string $aliasPrefix
return string

$allowedAssets protected_oe property

A list of authorized assets to add.
protected array $allowedAssets
return array

$container protected_oe property

The service container.
protected Application,Themosis\Foundation $container
return Themosis\Foundation\Application

$finder protected_oe property

The AssetFinder instance.
protected AssetFinder,Themosis\Asset $finder
return AssetFinder