/** * {@inheritdoc} */ public function getConfig() { $pluginInfo = $this->pluginList->getNext($this->subjectType, 'getConfig'); if (!$pluginInfo) { return parent::getConfig(); } else { return $this->___callPlugins('getConfig', func_get_args(), $pluginInfo); } }
protected function initResultPage() { if (!is_null($this->resultPage)) { return; } $this->resultPage = $this->resultPageFactory->create(); $this->resultPage->addHandle($this->getLayoutType()); $this->resultPage->getConfig()->getTitle()->set($this->__('M2ePro')); }
/** * Init layout for viewing product page * * @param \Magento\Framework\View\Result\Page $resultPage * @param \Magento\Catalog\Model\Product $product * @param null|\Magento\Framework\Object $params * @return \Magento\Catalog\Helper\Product\View * @SuppressWarnings(PHPMD.CyclomaticComplexity) * @SuppressWarnings(PHPMD.NPathComplexity) */ public function initProductLayout(ResultPage $resultPage, $product, $params = null) { $settings = $this->_catalogDesign->getDesignSettings($product); $pageConfig = $resultPage->getConfig(); if ($settings->getCustomDesign()) { $this->_catalogDesign->applyCustomDesign($settings->getCustomDesign()); } // Apply custom page layout if ($settings->getPageLayout()) { $pageConfig->setPageLayout($settings->getPageLayout()); } $urlSafeSku = rawurlencode($product->getSku()); // Load default page handles and page configurations if ($params && $params->getBeforeHandles()) { foreach ($params->getBeforeHandles() as $handle) { $resultPage->addPageLayoutHandles(['id' => $product->getId(), 'sku' => $urlSafeSku, 'type' => $product->getTypeId()], $handle); } } $resultPage->addPageLayoutHandles(['id' => $product->getId(), 'sku' => $urlSafeSku, 'type' => $product->getTypeId()]); if ($params && $params->getAfterHandles()) { foreach ($params->getAfterHandles() as $handle) { $resultPage->addPageLayoutHandles(['id' => $product->getId(), 'sku' => $urlSafeSku, 'type' => $product->getTypeId()], $handle); } } // Apply custom layout update once layout is loaded $update = $resultPage->getLayout()->getUpdate(); $layoutUpdates = $settings->getLayoutUpdates(); if ($layoutUpdates) { if (is_array($layoutUpdates)) { foreach ($layoutUpdates as $layoutUpdate) { $update->addUpdate($layoutUpdate); } } } $currentCategory = $this->_coreRegistry->registry('current_category'); $controllerClass = $this->_request->getFullActionName(); if ($controllerClass != 'catalog-product-view') { $pageConfig->addBodyClass('catalog-product-view'); } $pageConfig->addBodyClass('product-' . $product->getUrlKey()); if ($currentCategory instanceof \Magento\Catalog\Model\Category) { $pageConfig->addBodyClass('categorypath-' . $this->categoryUrlPathGenerator->getUrlPath($currentCategory))->addBodyClass('category-' . $currentCategory->getUrlKey()); } return $this; }
/** * Set layout type * * @param bool $inRange * @param \Magento\Framework\View\Result\Page $resultPage * @return \Magento\Framework\View\Result\Page */ protected function setLayoutType($inRange, $resultPage) { if ($this->_page->getPageLayout()) { if ($this->_page->getCustomPageLayout() && $this->_page->getCustomPageLayout() != 'empty' && $inRange) { $handle = $this->_page->getCustomPageLayout(); } else { $handle = $this->_page->getPageLayout(); } $resultPage->getConfig()->setPageLayout($handle); } return $resultPage; }
/** * Generate layout blocks * * @return $this */ public function generateLayoutBlocks() { $this->page->getConfig()->publicBuild(); return $this; }
public function testGetConfig() { $this->assertEquals($this->pageConfig, $this->page->getConfig()); }