Extends
lithium\core\StaticObject
Gets or sets options for various asset types.
Parameters
- string $type The name of the asset type, i.e. `'js'` or `'css'`.
- array $options If registering a new asset type or modifying an existing asset type, contains settings for the asset type, where the available keys are as follows: - `'suffix'`: The standard suffix for this content type, with leading dot ('.') if applicable. - `'filter'`: An array of key/value pairs representing simple string replacements to be done on a path once it is generated. - `'path'`: An array of key/value pairs where the keys are `String::insert()` compatible paths, and the values are array lists of keys to be inserted into the path string.
Returns
array If `$type` is empty, an associative array of all registered types and all associated options is returned. If `$type` is a string and `$options` is empty, returns an associative array with the options for `$type`. If `$type` and `$options` are both non-empty, returns `null`.Source
public static function assets($type = null, $options = array()) {
$defaults = array('suffix' => null, 'filter' => null, 'path' => array());
if (!$type) {
return static::_assets();
}
if ($options === false) {
unset(static::$_assets[$type]);
}
if (!$options) {
return static::_assets($type);
}
$options = (array) $options + $defaults;
if ($base = static::_assets($type)) {
$options = array_merge($base, array_filter($options));
}
static::$_assets[$type] = $options;
}