/** * Include RequireJs configuration as an asset on the page * * @return $this */ protected function _prepareLayout() { $requireJsConfig = $this->fileManager->createRequireJsConfigAsset(); $requireJsMixinsConfig = $this->fileManager->createRequireJsMixinsAsset(); $assetCollection = $this->pageConfig->getAssetCollection(); $after = RequireJsConfig::REQUIRE_JS_FILE_NAME; if ($this->minification->isEnabled('js')) { $minResolver = $this->fileManager->createMinResolverAsset(); $assetCollection->insert($minResolver->getFilePath(), $minResolver, $after); $after = $minResolver->getFilePath(); } if ($this->bundleConfig->isBundlingJsFiles()) { $bundleAssets = $this->fileManager->createBundleJsPool(); $staticAsset = $this->fileManager->createStaticJsAsset(); /** @var \Magento\Framework\View\Asset\File $bundleAsset */ if (!empty($bundleAssets) && $staticAsset !== false) { $bundleAssets = array_reverse($bundleAssets); foreach ($bundleAssets as $bundleAsset) { $assetCollection->insert($bundleAsset->getFilePath(), $bundleAsset, $after); } $assetCollection->insert($staticAsset->getFilePath(), $staticAsset, reset($bundleAssets)->getFilePath()); $after = $staticAsset->getFilePath(); } } $assetCollection->insert($requireJsConfig->getFilePath(), $requireJsConfig, $after); $assetCollection->insert($requireJsMixinsConfig->getFilePath(), $requireJsMixinsConfig, $after); return parent::_prepareLayout(); }
/** * Include RequireJs configuration as an asset on the page * * @return $this */ protected function _prepareLayout() { $requireJsConfig = $this->fileManager->createRequireJsConfigAsset(); $assetCollection = $this->pageConfig->getAssetCollection(); $assetCollection->insert($requireJsConfig->getFilePath(), $requireJsConfig, RequireJsConfig::REQUIRE_JS_FILE_NAME); if ($this->bundleConfig->isBundlingJsFiles()) { $bundleAssets = $this->fileManager->createBundleJsPool(); $staticAsset = $this->fileManager->createStaticJsAsset(); /** @var \Magento\Framework\View\Asset\File $bundleAsset */ if (!empty($bundleAssets) && $staticAsset !== false) { $bundleAssets = array_reverse($bundleAssets); foreach ($bundleAssets as $bundleAsset) { $assetCollection->insert($bundleAsset->getFilePath(), $bundleAsset, RequireJsConfig::REQUIRE_JS_FILE_NAME); } $assetCollection->insert($staticAsset->getFilePath(), $staticAsset, RequireJsConfig::CONFIG_FILE_NAME); } } return parent::_prepareLayout(); }
/** * Prepare global layout * * @return $this */ protected function _prepareLayout() { $page = $this->getPage(); // show breadcrumbs if ($this->_scopeConfig->getValue('web/default/show_cms_breadcrumbs', \Magento\Store\Model\ScopeInterface::SCOPE_STORE) && ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs')) && $page->getIdentifier() !== $this->_scopeConfig->getValue('web/default/cms_home_page', \Magento\Store\Model\ScopeInterface::SCOPE_STORE) && $page->getIdentifier() !== $this->_scopeConfig->getValue('web/default/cms_no_route', \Magento\Store\Model\ScopeInterface::SCOPE_STORE)) { $breadcrumbs->addCrumb('home', array('label' => __('Home'), 'title' => __('Go to Home Page'), 'link' => $this->_storeManager->getStore()->getBaseUrl())); $breadcrumbs->addCrumb('cms_page', array('label' => $page->getTitle(), 'title' => $page->getTitle())); } $this->pageConfig->addBodyClass('cms-' . $page->getIdentifier()); $head = $this->getLayout()->getBlock('head'); if ($head) { $head->setTitle($page->getTitle()); $head->setKeywords($page->getMetaKeywords()); $head->setDescription($page->getMetaDescription()); } $pageMainTitle = $this->getLayout()->getBlock('page.main.title'); if ($pageMainTitle) { // Setting empty page title if content heading is absent $cmsTitle = $page->getContentHeading() ?: ' '; $pageMainTitle->setPageTitle($this->escapeHtml($cmsTitle)); } return parent::_prepareLayout(); }
/** * Include RequireJs configuration as an asset on the page * * @return $this */ protected function _prepareLayout() { $this->addInlineTranslationConfig(); return parent::_prepareLayout(); }
/** * Prepare global layout * * @return $this */ protected function _prepareLayout() { $page = $this->getPage(); $this->_addBreadcrumbs($page); $this->pageConfig->addBodyClass('cms-' . $page->getIdentifier()); $this->pageConfig->getTitle()->set($page->getTitle()); $this->pageConfig->setKeywords($page->getMetaKeywords()); $this->pageConfig->setDescription($page->getMetaDescription()); $pageMainTitle = $this->getLayout()->getBlock('page.main.title'); if ($pageMainTitle) { // Setting empty page title if content heading is absent $cmsTitle = $page->getContentHeading() ?: ' '; $pageMainTitle->setPageTitle($this->escapeHtml($cmsTitle)); } return parent::_prepareLayout(); }
/** * Prepare layout * * @return $this */ protected function _prepareLayout() { $this->priceLayout->addHandle($this->getPriceRenderHandle()); $this->priceLayout->loadLayout(); return parent::_prepareLayout(); }
/** * Preparing layout, adding buttons * * @return $this */ protected function _prepareLayout() { $this->addChild('labels', 'Magento\\Eav\\Block\\Adminhtml\\Attribute\\Edit\\Options\\Labels'); $this->addChild('options', 'Magento\\Eav\\Block\\Adminhtml\\Attribute\\Edit\\Options\\Options'); return parent::_prepareLayout(); }