FluidTYPO3\Vhs\Service\AssetService::buildAll PHP Method

buildAll() public method

public buildAll ( array $parameters, object $caller, boolean $cached = true ) : void
$parameters array
$caller object
$cached boolean If TRUE, treats this inclusion as happening in a cached context
return void
    public function buildAll(array $parameters, $caller, $cached = true)
    {
        if (false === $this->objectManager instanceof ObjectManager) {
            $this->objectManager = GeneralUtility::makeInstance(ObjectManager::class);
            $this->configurationManager = $this->objectManager->get(ConfigurationManagerInterface::class);
        }
        $settings = $this->getSettings();
        $cached = (bool) $cached;
        $buildTypoScriptAssets = !static::$typoScriptAssetsBuilt && ($cached || $GLOBALS['TSFE']->no_cache);
        if ($buildTypoScriptAssets && isset($settings['asset']) && is_array($settings['asset'])) {
            foreach ($settings['asset'] as $name => $typoScriptAsset) {
                if (!isset($GLOBALS['VhsAssets'][$name]) && is_array($typoScriptAsset)) {
                    if (!isset($typoScriptAsset['name'])) {
                        $typoScriptAsset['name'] = $name;
                    }
                    Asset::createFromSettings($typoScriptAsset);
                }
            }
            static::$typoScriptAssetsBuilt = true;
        }
        if (!isset($GLOBALS['VhsAssets']) || !is_array($GLOBALS['VhsAssets'])) {
            return;
        }
        $assets = $GLOBALS['VhsAssets'];
        $assets = $this->sortAssetsByDependency($assets);
        $assets = $this->manipulateAssetsByTypoScriptSettings($assets);
        $buildDebugRequested = isset($settings['asset']['debugBuild']) && $settings['asset']['debugBuild'] > 0;
        $assetDebugRequested = isset($settings['asset']['debug']) && $settings['asset']['debug'] > 0;
        $useDebugUtility = isset($settings['asset']['useDebugUtility']) && $settings['asset']['useDebugUtility'] > 0 || false === isset($settings['asset']['useDebugUtility']);
        if (true === ($buildDebugRequested || $assetDebugRequested)) {
            if (true === $useDebugUtility) {
                DebuggerUtility::var_dump($assets);
            } else {
                echo var_export($assets, true);
            }
        }
        $this->placeAssetsInHeaderAndFooter($assets, $cached);
    }