当前位置: 首页>>代码示例>>PHP>>正文


PHP Template::_prepareLayout方法代码示例

本文整理汇总了PHP中Magento\Framework\View\Element\Template::_prepareLayout方法的典型用法代码示例。如果您正苦于以下问题:PHP Template::_prepareLayout方法的具体用法?PHP Template::_prepareLayout怎么用?PHP Template::_prepareLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Magento\Framework\View\Element\Template的用法示例。


在下文中一共展示了Template::_prepareLayout方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: _prepareLayout

 /**
  * Add payment info block to layout
  *
  * @return $this
  */
 protected function _prepareLayout()
 {
     if ($info = $this->getPaymentInfo()) {
         $this->setChild($this->_getInfoBlockName(), $this->_paymentData->getInfoBlock($info, $this->getLayout()));
     }
     return parent::_prepareLayout();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:12,代码来源:AbstractContainer.php

示例2: _prepareLayout

 /**
  * @return $this
  * @SuppressWarnings(PHPMD.CyclomaticComplexity)
  * @SuppressWarnings(PHPMD.NPathComplexity)
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $category = $this->getCategory();
     $title = $category ? $category->getName() : $this->config->getBlogName();
     $metaTitle = $category ? $category->getMetaTitle() ? $category->getMetaTitle() : $category->getName() : $this->config->getBaseMetaTitle();
     $metaDescription = $category ? $category->getMetaDescription() ? $category->getMetaDescription() : $category->getName() : $this->config->getBaseMetaDescription();
     $metaKeywords = $category ? $category->getMetaKeywords() ? $category->getMetaKeywords() : $category->getName() : $this->config->getBaseMetaKeywords();
     $this->pageConfig->getTitle()->set($metaTitle);
     $this->pageConfig->setDescription($metaDescription);
     $this->pageConfig->setKeywords($metaKeywords);
     /** @var \Magento\Theme\Block\Html\Title $pageMainTitle */
     $pageMainTitle = $this->getLayout()->getBlock('page.main.title');
     if ($pageMainTitle) {
         $pageMainTitle->setPageTitle($title);
     }
     /** @var \Magento\Theme\Block\Html\Breadcrumbs $breadcrumbs */
     if ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs')) {
         $breadcrumbs->addCrumb('home', ['label' => __('Home'), 'title' => __('Go to Home Page'), 'link' => $this->context->getUrlBuilder()->getBaseUrl()])->addCrumb('blog', ['label' => $this->config->getBlogName(), 'title' => $this->config->getBlogName(), 'link' => $this->config->getBaseUrl()]);
         if ($category) {
             $ids = $category->getParentIds();
             $ids[] = 0;
             $parents = $this->categoryCollectionFactory->create()->addFieldToFilter('entity_id', $ids)->addNameToSelect()->excludeRoot()->setOrder('level', 'asc');
             /** @var \Mirasvit\Blog\Model\Category $cat */
             foreach ($parents as $cat) {
                 $breadcrumbs->addCrumb($cat->getId(), ['label' => $cat->getName(), 'title' => $cat->getName(), 'link' => $cat->getUrl()]);
             }
             $breadcrumbs->addCrumb($category->getId(), ['label' => $category->getName(), 'title' => $category->getName()]);
         }
     }
     return $this;
 }
开发者ID:mirasvit,项目名称:module-blog,代码行数:37,代码来源:View.php

示例3: _prepareLayout

 /**
  * @return $this
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $this->getLayout()->createBlock('Magento\\Catalog\\Block\\Breadcrumbs');
     $category = $this->getCurrentCategory();
     if ($category) {
         $title = $category->getMetaTitle();
         if ($title) {
             $this->pageConfig->getTitle()->set($title);
         }
         $description = $category->getMetaDescription();
         if ($description) {
             $this->pageConfig->setDescription($description);
         }
         $keywords = $category->getMetaKeywords();
         if ($keywords) {
             $this->pageConfig->setKeywords($keywords);
         }
         if ($this->_categoryHelper->canUseCanonicalTag()) {
             $this->pageConfig->addRemotePageAsset($category->getUrl(), 'canonical', ['attributes' => ['rel' => 'canonical']]);
         }
         $pageMainTitle = $this->getLayout()->getBlock('page.main.title');
         if ($pageMainTitle) {
             $pageMainTitle->setPageTitle($this->getCurrentCategory()->getName());
         }
     }
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:31,代码来源:View.php

示例4: _prepareLayout

 protected function _prepareLayout()
 {
     $block = $this->getLayout()->createBlock($this->getWidgetBlock(), $this->getNameInLayout() . '_tab');
     if ($block instanceof \Magento\Framework\View\Element\Template) {
         $this->setChild($this->getNameInLayout() . '_tab', $block);
     }
     return parent::_prepareLayout();
 }
开发者ID:swissup,项目名称:easytabs,代码行数:8,代码来源:Template.php

示例5: _prepareLayout

 /**
  * Set Billing Agreement instance
  *
  * @return $this
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager')->setCollection($this->getBillingAgreements())->setIsOutputRequired(false);
     $this->setChild('pager', $pager)->setBackUrl($this->getUrl('customer/account/'));
     $this->getBillingAgreements()->load();
     return $this;
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:13,代码来源:Agreements.php

示例6: _prepareLayout

 /**
  * Get current product instance
  *
  * @return $this
  */
 protected function _prepareLayout()
 {
     $product = $this->_registry->registry('current_product');
     if ($product && $product->getId()) {
         $this->_product = $product;
     }
     return parent::_prepareLayout();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:13,代码来源:View.php

示例7: _prepareLayout

 /**
  * @return AbstractBlock
  */
 protected function _prepareLayout()
 {
     $breadcrumbs = $this->getLayout()->getBlock('breadcrumbs');
     if ($breadcrumbs) {
         $breadcrumbs->addCrumb('home', ['label' => __('Home'), 'title' => __('Go to Home Page'), 'link' => $this->_storeManager->getStore()->getBaseUrl()])->addCrumb('search', ['label' => __('Catalog Advanced Search'), 'link' => $this->getUrl('*/*/')])->addCrumb('search_result', ['label' => __('Results')]);
     }
     return parent::_prepareLayout();
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:11,代码来源:Result.php

示例8: _prepareLayout

 /**
  * Preparing layout
  *
  * @return $this
  */
 protected function _prepareLayout()
 {
     if ($this->hasRegistryKey()) {
         $params = $this->coreRegistry->registry($this->getRegistryKey());
         $this->setParams($params);
     }
     return parent::_prepareLayout();
 }
开发者ID:opexsw,项目名称:magento2,代码行数:13,代码来源:Iframe.php

示例9: _prepareLayout

 /**
  * @return $this
  */
 protected function _prepareLayout()
 {
     $headBlock = $this->getLayout()->getBlock('head');
     if ($headBlock) {
         $headBlock->setTitle($this->getProduct()->getMetaTitle());
     }
     return parent::_prepareLayout();
 }
开发者ID:aiesh,项目名称:magento2,代码行数:11,代码来源:Gallery.php

示例10: _prepareLayout

 /**
  * @return AbstractBlock
  */
 public function _prepareLayout()
 {
     // add Home breadcrumb
     if ($breadcrumbs = $this->getLayout()->getBlock('breadcrumbs')) {
         $breadcrumbs->addCrumb('home', ['label' => __('Home'), 'title' => __('Go to Home Page'), 'link' => $this->_storeManager->getStore()->getBaseUrl()])->addCrumb('search', ['label' => __('Catalog Advanced Search')]);
     }
     return parent::_prepareLayout();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:11,代码来源:Form.php

示例11: _prepareLayout

 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $name = $this->getNameInLayout();
     // Add the blocks as children of this, so that the commenting exclusions take effect
     $this->_layout->addBlock($this->_itemBlock, $name . 'list.item', $name);
     $this->_layout->addBlock($this->_itemContainer, $name . 'list.container', $name);
 }
开发者ID:llapgoch,项目名称:magento2-developer-toolbar,代码行数:8,代码来源:AbstractPanel.php

示例12: _prepareLayout

 /**
  * @return $this
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager', 'sales.order.history.pager')->setCollection($this->getOrders());
     $this->setChild('pager', $pager);
     $this->getOrders()->load();
     return $this;
 }
开发者ID:aiesh,项目名称:magento2,代码行数:11,代码来源:History.php

示例13: _prepareLayout

 /**
  * Configure product view blocks
  *
  * @return $this
  */
 protected function _prepareLayout()
 {
     // Set custom submit url route for form - to submit updated options to cart
     $block = $this->getLayout()->getBlock('product.info');
     if ($block) {
         $block->setSubmitRouteData(['route' => 'checkout/cart/updateItemOptions', 'params' => ['id' => $this->getRequest()->getParam('id')]]);
     }
     return parent::_prepareLayout();
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:14,代码来源:Configure.php

示例14: _prepareLayout

 /**
  * @return $this
  */
 protected function _prepareLayout()
 {
     parent::_prepareLayout();
     /** @var \Magento\Theme\Block\Html\Pager */
     $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager', 'newsblock.news.list.pager');
     $pager->setLimit(3)->setCollection($this->getNews());
     $this->setChild('pager', $pager);
     return $this;
 }
开发者ID:Tossimo,项目名称:Newsblock,代码行数:12,代码来源:NewsblockList.php

示例15: _prepareLayout

 /**
  * Apply layer
  *
  * @return $this
  */
 protected function _prepareLayout()
 {
     $this->renderer = $this->getChildBlock('renderer');
     foreach ($this->filterList->getFilters($this->_catalogLayer) as $filter) {
         $filter->apply($this->getRequest());
     }
     $this->getLayer()->apply();
     return parent::_prepareLayout();
 }
开发者ID:pradeep-wagento,项目名称:magento2,代码行数:14,代码来源:Navigation.php


注:本文中的Magento\Framework\View\Element\Template::_prepareLayout方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。