|
| __construct (WebAssetRegistry $registry) |
|
| getRegistry () |
|
| reset () |
|
| __call ($method, $arguments) |
|
| useAsset (string $type, string $name) |
|
| disableAsset (string $type, string $name) |
|
| getAssetState (string $type, string $name) |
|
| isAssetActive (string $type, string $name) |
|
| assetExists (string $type, string $name) |
|
| registerAsset (string $type, $asset, string $uri='', array $options=[], array $attributes=[], array $dependencies=[]) |
|
| getAsset (string $type, string $name) |
|
| getAssets (string $type, bool $sort=false) |
|
| getInlineRelation (array $assets) |
|
| filterOutInlineAssets (array &$assets) |
|
| addInline (string $type, $content, array $options=[], array $attributes=[], array $dependencies=[]) |
|
| lock () |
|
| getManagerState () |
|
Web Asset Manager class
WebAssetManager registerStyle(WebAssetItem|string $asset, string $uri = '', $options = [], $attributes = [], $dependencies = []) WebAssetManager registerAndUseStyle(WebAssetItem|string $asset, string $uri = '', $options = [], $attributes = [], $dependencies = []) WebAssetManager useStyle($name) WebAssetManager disableStyle($name) WebAssetManager addInlineStyle(WebAssetItem|string $content, $options = [], $attributes = [], $dependencies = [])
WebAssetManager registerScript(WebAssetItem|string $asset, string $uri = '', $options = [], $attributes = [], $dependencies = []) WebAssetManager registerAndUseScript(WebAssetItem|string $asset, string $uri = '', $options = [], $attributes = [], $dependencies = []) WebAssetManager useScript($name) WebAssetManager disableScript($name) WebAssetManager addInlineScript(WebAssetItem|string $content, $options = [], $attributes = [], $dependencies = [])
WebAssetManager registerPreset(WebAssetItem|string $asset, string $uri = '', $options = [], $attributes = [], $dependencies = []) WebAssetManager registerAndUsePreset(WebAssetItem|string $asset, string $uri = '', $options = [], $attributes = [], $dependencies = []) WebAssetManager usePreset($name) WebAssetManager disablePreset($name)
- Depuis
- 4.0.0
addInline |
( |
string |
$type, |
|
|
|
$content, |
|
|
array |
$options = [] , |
|
|
array |
$attributes = [] , |
|
|
array |
$dependencies = [] |
|
) |
| |
Add a new inline content asset. Allow to register WebAssetItem instance in the registry, by call addInline($type, $assetInstance) Or create an asset on fly (from name and Uri) and register in the registry, by call addInline($type, $content, $options ....)
- Paramètres
-
string | $type | The asset type, script or style |
WebAssetItem | string | $content | The content to of inline asset |
array | $options | Additional options for the asset |
array | $attributes | Attributes for the asset |
array | $dependencies | Asset dependencies |
- Renvoie
- self
- Depuis
- 4.0.0
- Exceptions
-
Références $attributes, $content, $name, $options, $this, $type, class, et elseif.
getInlineRelation |
( |
array |
$assets | ) |
|
Helper method to calculate inline to non inline relation (before/after positions). Return associated array, which contain dependency (handle) name as key, and list of inline items for each position. Example: ['handle.name' => ['before' => ['inline1', 'inline2'], 'after' => ['inline3', 'inline4']]]
Note: If inline asset have a multiple dependencies, then will be used last one from the list for positioning
- Paramètres
-
WebAssetItem[] | $assets The assets list |
- Renvoie
- array
- Depuis
- 4.0.0
Références $position, et null.
registerAsset |
( |
string |
$type, |
|
|
|
$asset, |
|
|
string |
$uri = '' , |
|
|
array |
$options = [] , |
|
|
array |
$attributes = [] , |
|
|
array |
$dependencies = [] |
|
) |
| |
Register a new asset. Allow to register WebAssetItem instance in the registry, by call registerAsset($type, $assetInstance) Or create an asset on fly (from name and Uri) and register in the registry, by call registerAsset($type, $assetName, $uri, $options ....)
- Paramètres
-
string | $type | The asset type, script or style |
WebAssetItem | string | $asset | The asset name or instance to register |
string | $uri | The URI for the asset |
array | $options | Additional options for the asset |
array | $attributes | Attributes for the asset |
array | $dependencies | Asset dependencies |
- Renvoie
- self
- Depuis
- 4.0.0
- Exceptions
-
Références $attributes, $options, $this, $type, $uri, class, et elseif.
Enable list of assets provided by Preset item.
"Preset" a special kind of asset that hold a list of assets that has to be enabled, same as direct call of useAsset() to each of item in list. Can hold mixed types of assets (script, style, another preset, etc), the type provided after # symbol, after the asset name, example: foo::style, bar::script.
The method call useAsset() internally for each of its dependency, this is important for keeping FIFO order of enabled items. The Preset not a strict asset, and each of its dependency can be safely disabled by use of disableAsset() later.
- Paramètres
-
string | $name | The asset name |
- Renvoie
- self
- Exceptions
-
UnsatisfiedDependencyException | When Asset dependency cannot be found |
- Depuis
- 4.0.0
Références $name, et $this.