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


PHP Page::addPageLayoutHandles方法代码示例

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


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

示例1: addPageLayoutHandles

 /**
  * {@inheritdoc}
  */
 public function addPageLayoutHandles(array $parameters = array(), $defaultHandle = null)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'addPageLayoutHandles');
     if (!$pluginInfo) {
         return parent::addPageLayoutHandles($parameters, $defaultHandle);
     } else {
         return $this->___callPlugins('addPageLayoutHandles', func_get_args(), $pluginInfo);
     }
 }
开发者ID:HaonanXu,项目名称:der-snack-backup,代码行数:12,代码来源:Interceptor.php

示例2: testAddPageLayoutHandlesWithDefaultHandle

 public function testAddPageLayoutHandlesWithDefaultHandle()
 {
     $defaultHandle = 'default_handle';
     $parameters = ['key_one' => 'val_one', 'key_two' => 'val_two'];
     $expected = ['default_handle', 'default_handle_key_one_val_one', 'default_handle_key_two_val_two'];
     $this->request->expects($this->never())->method('getFullActionName');
     $this->layoutMerge->expects($this->any())->method('addHandle')->with($expected)->willReturnSelf();
     $this->page->addPageLayoutHandles($parameters, $defaultHandle);
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:9,代码来源:PageTest.php

示例3: initProductLayout

 /**
  * 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;
 }
开发者ID:shabbirvividads,项目名称:magento2,代码行数:55,代码来源:View.php

示例4: addPageLayoutHandles

 /**
  * Add layout updates handles associated with the action page
  *
  * @param array|null $parameters page parameters
  * @param string|null $defaultHandle
  * @return bool
  */
 public function addPageLayoutHandles(array $parameters = [], $defaultHandle = null)
 {
     return $this->page->addPageLayoutHandles($parameters, $defaultHandle);
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:11,代码来源:View.php


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