Back to WebAssetManager class

Method filterOutInlineAssets

public \Joomla\CMS\WebAsset\WebAssetItem[]
filterOutInlineAssets
(array &$assets)
Helper method to filter an inline assets
Parameters
  • \Joomla\CMS\WebAsset\WebAssetItem[] $assets Reference to a full list of active assets
Returns
  • \Joomla\CMS\WebAsset\WebAssetItem[] Array of inline assets
Since
  • 4.0.0

Method filterOutInlineAssets - Source code

/**
 * Helper method to filter an inline assets
 *
 * @param   WebAssetItem[]  $assets  Reference to a full list of active assets
 *
 * @return  WebAssetItem[]  Array of inline assets
 *
 * @since  4.0.0
 */
public function filterOutInlineAssets(array &$assets) : array
{
    $inlineAssets = [];
    foreach ($assets as $k => $asset) {
        if (!$asset->getOption('inline')) {
            continue;
        }
        // Remove inline assets from assets list, and add to list of inline
        unset($assets[$k]);
        $inlineAssets[$asset->getName()] = $asset;
    }
    return $inlineAssets;
}