Manages the assets loading for a feature.

WARNING: this method doesn't register the asset: You have to take care of it by yourself (tipically in assets.php)

author etessore
version 1.0.1
package classes
deprecated uses ThemeHelpers::load_css() and ThemeHelpers::load_js() instead

 Methods

Adds an asset.

add_asset(string $handle, string $type) : \FeatureWithAssets

You cannot define an asset here, to do it please use wp_register_script or wp_register_style in functions.php or config/assets.php WARNING: this method doesn't register the asset: You have to take care of it by yourself (tipically in assets.php)

Parameters

$handle

string

the handle for the asset.

$type

string

the asset type: js|css

Returns

\FeatureWithAssets$this for chainability

Loads needed scripts and css

load_assets() : \FeatureWithAssets

Returns

\FeatureWithAssets$this for chainability

Loads needed scripts and css

load_assets_callback() : \FeatureWithAssets

Returns

\FeatureWithAssets$this for chainability

Set the assets list to the given one

set_assets(array $assets) : \FeatureWithAssets

Parameters

$assets

array

the list of assets: array('js'=>array(...), 'css'=>array(...));

Returns

\FeatureWithAssets$this for chainability

 Properties

 

the list of assets to be loaded array('js'=>array(...), 'css'=>array(...));

$assets : array