pageConfig = $pageConfig; $this->fileManager = $fileManager; $this->inline = $inline; } /** * Include RequireJs configuration as an asset on the page * * @return $this */ protected function _prepareLayout() { $this->addInlineTranslationConfig(); return parent::_prepareLayout(); } /** * Include RequireJs inline translation configuration as an asset on the page * @return void */ private function addInlineTranslationConfig() { if ($this->inline->isAllowed()) { $after = RequireJsConfig::REQUIRE_JS_FILE_NAME; $tConfig = $this->fileManager->createTranslateConfigAsset(); $assetCollection = $this->pageConfig->getAssetCollection(); $assetCollection->insert( $tConfig->getFilePath(), $tConfig, $after ); } } }