public static method

Gets or sets options for various asset types.


  • 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.
    • 'paths': An array of key/value pairs where the keys are Text::insert() compatible paths, and the values are array lists of keys to be inserted into the path string.



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.


	public static function assets($type = null, $options = []) {
		$defaults = ['suffix' => null, 'filter' => null, 'paths' => []];

		if (!$type) {
			return static::_assets();
		if ($options === false) {
		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;