本文整理汇总了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();
}
示例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;
}
示例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;
}
示例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();
}
示例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;
}
示例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();
}
示例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();
}
示例8: _prepareLayout
/**
* Preparing layout
*
* @return $this
*/
protected function _prepareLayout()
{
if ($this->hasRegistryKey()) {
$params = $this->coreRegistry->registry($this->getRegistryKey());
$this->setParams($params);
}
return parent::_prepareLayout();
}
示例9: _prepareLayout
/**
* @return $this
*/
protected function _prepareLayout()
{
$headBlock = $this->getLayout()->getBlock('head');
if ($headBlock) {
$headBlock->setTitle($this->getProduct()->getMetaTitle());
}
return parent::_prepareLayout();
}
示例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();
}
示例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);
}
示例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;
}
示例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();
}
示例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;
}
示例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();
}