本文整理匯總了PHP中Magento\Framework\View\Element\AbstractBlock::_prepareLayout方法的典型用法代碼示例。如果您正苦於以下問題:PHP AbstractBlock::_prepareLayout方法的具體用法?PHP AbstractBlock::_prepareLayout怎麽用?PHP AbstractBlock::_prepareLayout使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\View\Element\AbstractBlock
的用法示例。
在下文中一共展示了AbstractBlock::_prepareLayout方法的7個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: _prepareLayout
/**
* 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();
}
示例2: _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();
}
示例3: _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();
}
示例4: _prepareLayout
/**
* Include RequireJs configuration as an asset on the page
*
* @return $this
*/
protected function _prepareLayout()
{
$this->addInlineTranslationConfig();
return parent::_prepareLayout();
}
示例5: _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();
}
示例6: _prepareLayout
/**
* Prepare layout
*
* @return $this
*/
protected function _prepareLayout()
{
$this->priceLayout->addHandle($this->getPriceRenderHandle());
$this->priceLayout->loadLayout();
return parent::_prepareLayout();
}
示例7: _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();
}