/** * 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(); }
/** * @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; }
/** * @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; }
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(); }
/** * 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; }
/** * 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(); }
/** * @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(); }
/** * Preparing layout * * @return $this */ protected function _prepareLayout() { if ($this->hasRegistryKey()) { $params = $this->coreRegistry->registry($this->getRegistryKey()); $this->setParams($params); } return parent::_prepareLayout(); }
/** * @return $this */ protected function _prepareLayout() { $headBlock = $this->getLayout()->getBlock('head'); if ($headBlock) { $headBlock->setTitle($this->getProduct()->getMetaTitle()); } return parent::_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(); }
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); }
/** * @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; }
/** * 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(); }
/** * @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; }
/** * 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(); }
/** * Preparing global layout * * You can redefine this method in child classes for changing layout * * @return \Magento\Framework\View\Element\AbstractBlock */ protected function _prepareLayout() { $params = $this->_coreRegistry->registry('authorizenet_directpost_form_params'); if (is_null($params)) { $params = array(); } $this->setParams($params); return parent::_prepareLayout(); }
/** * @return $this */ protected function _prepareLayout() { parent::_prepareLayout(); if ($this->getTestimonials()) { $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager', 'testimonials.list.pager')->setCollection($this->getTestimonials()); $this->setChild('pager', $pager); $this->getTestimonials()->load(); } return $this; }
/** * Prepare global layout * * @return $this */ protected function _prepareLayout() { $post = $this->getPost(); $this->_addBreadcrumbs($post); $this->pageConfig->addBodyClass('post-' . $post->getID()); $this->pageConfig->getTitle()->set($post->getTitle()); //$this->pageConfig->setKeywords($post->getMetaKeywords()); //$this->pageConfig->setDescription($post->getMetaDescription()); return parent::_prepareLayout(); }
/** * @return $this */ protected function _prepareLayout() { parent::_prepareLayout(); /** @var \Magento\Theme\Block\Html\Pager */ $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager', 'blog.blog.list.pager'); $pager->setLimit(5)->setShowAmounts(false)->setCollection($this->getCollection()); $this->setChild('pager', $pager); $this->getCollection()->load(); return $this; }
/** * @return $this */ protected function _prepareLayout() { parent::_prepareLayout(); /** @var \Magento\Theme\Block\Html\Pager $pager */ $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager', 'sample_news.author.list.pager'); $pager->setCollection($this->getAuthors()); $this->setChild('pager', $pager); $this->getAuthors()->load(); return $this; }
/** * Prepare children blocks * * @return $this */ protected function _prepareLayout() { /** * Create child blocks for payment methods forms */ foreach ($this->getMethods() as $method) { $this->setChild('payment.method.' . $method->getCode(), $this->_paymentHelper->getMethodFormBlock($method, $this->_layout)); } return parent::_prepareLayout(); }
public function _prepareLayout() { parent::_prepareLayout(); $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager', 'testimonial.pager'); $pager->setAvailableLimit([1 => 1, 10 => 10, 20 => 20, 50 => 50])->setLimit(1); $pager->setCollection($this->getTestimonial()); $this->setChild('pager', $pager); $this->getTestimonial()->load(); return $this; }
/** * @return $this */ protected function _prepareLayout() { parent::_prepareLayout(); /** @var \Magento\Theme\Block\Html\Pager $pager */ $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager', 'gemtoo_blog.article.list.pager'); $pager->setCollection($this->getArticles()); $this->setChild('pager', $pager); $this->getArticles()->load(); return $this; }
/** * Golbal Prepare Layout * * @return $this */ public function _prepareLayout() { $this->_addBreadcrumbs(); $this->pageConfig->getTitle()->set("Blog"); $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager'); $pager->setShowPerPage("2"); $pager->setCollection($this->getPostCollection()); $this->setChild("posts.pager", $pager); parent::_prepareLayout(); }
protected function _prepareLayout() { parent::_prepareLayout(); //$this->pageConfig->getTitle()->set("Testing"); if ($this->getCollection()) { $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager', 'ktpl_crud_toolbar_pager')->setAvailableLimit($this->getAvailableLimit())->setLimit($this->getLimit())->setCollection($this->getCollection()); $this->setChild('pager', $pager); $this->getCollection()->load(); } return $this; }
/** * Preparing global layout * * @return $this */ protected function _prepareLayout() { $grid = $this->getGridBlock(); if (is_string($grid)) { $grid = $this->getLayout()->getBlock($grid); } if ($grid instanceof \Magento\Backend\Block\Widget\Grid) { $this->setGridBlock($grid)->setSerializeData($grid->{$this->getCallback()}()); } return parent::_prepareLayout(); }
/** * Prepare layout * * @return $this */ protected function _prepareLayout() { $title = $this->getSearchQueryText(); $this->pageConfig->getTitle()->set($title); // add Home breadcrumb $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' => $title, 'title' => $title]); } return parent::_prepareLayout(); }
/** * Enter description here... * * @return $this */ protected function _prepareLayout() { parent::_prepareLayout(); $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager', 'downloadable.customer.products.pager')->setCollection($this->getItems())->setPath('downloadable/customer/products'); $this->setChild('pager', $pager); $this->getItems()->load(); foreach ($this->getItems() as $item) { $item->setPurchased($this->getPurchased()->getItemById($item->getPurchasedId())); } return $this; }
/** * Add Link elements to head * * @return $this */ protected function _prepareLayout() { $head = $this->getLayout()->getBlock('head'); $feeds = $this->getRssMiscFeeds(); if ($head && !empty($feeds)) { foreach ($feeds as $feed) { $head->addRss($feed['label'], $feed['url']); } } return parent::_prepareLayout(); }
/** * @return $this */ protected function _prepareLayout() { /** @var \Magento\Theme\Block\Html\Pager $pager */ $pager = $this->getLayout()->createBlock('Magento\\Theme\\Block\\Html\\Pager'); $pager->setNameInLayout('sample_news.author.view.category.pager'); $pager->setPageVarName('p-category'); $pager->setFragment('sample_news.author.view.category'); $pager->setLimitVarName('l-category'); $pager->setCollection($this->getCategoryCollection()); $this->setChild('sample_news.author.view.category.pager', $pager); return parent::_prepareLayout(); }