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


PHP Page::getDefaultLayoutHandle方法代码示例

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


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

示例1: testGetDefaultLayoutHandle

 public function testGetDefaultLayoutHandle()
 {
     $fullActionName = 'Full_Action_Name';
     $expectedFullActionName = 'full_action_name';
     $this->request->expects($this->any())->method('getFullActionName')->will($this->returnValue($fullActionName));
     $this->assertEquals($expectedFullActionName, $this->page->getDefaultLayoutHandle());
 }
开发者ID:kidaa30,项目名称:magento2-platformsh,代码行数:7,代码来源:PageTest.php

示例2: getDefaultLayoutHandle

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

示例3: prepareAndRender

 /**
  * Prepares product view page - inits layout and all needed stuff
  *
  * $params can have all values as $params in \Magento\Catalog\Helper\Product - initProduct().
  * Plus following keys:
  *   - 'buy_request' - \Magento\Framework\DataObject holding buyRequest to configure product
  *   - 'specify_options' - boolean, whether to show 'Specify options' message
  *   - 'configure_mode' - boolean, whether we're in Configure-mode to edit product configuration
  *
  * @param \Magento\Framework\View\Result\Page $resultPage
  * @param int $productId
  * @param \Magento\Framework\App\Action\Action $controller
  * @param null|\Magento\Framework\DataObject $params
  * @throws \Magento\Framework\Exception\LocalizedException
  * @throws \Magento\Framework\Exception\NoSuchEntityException
  * @return \Magento\Catalog\Helper\Product\View
  */
 public function prepareAndRender(ResultPage $resultPage, $productId, $controller, $params = null)
 {
     /**
      * Remove default action handle from layout update to avoid its usage during processing of another action,
      * It is possible that forwarding to another action occurs, e.g. to 'noroute'.
      * Default action handle is restored just before the end of current method.
      */
     $defaultActionHandle = $resultPage->getDefaultLayoutHandle();
     $handles = $resultPage->getLayout()->getUpdate()->getHandles();
     if (in_array($defaultActionHandle, $handles)) {
         $resultPage->getLayout()->getUpdate()->removeHandle($resultPage->getDefaultLayoutHandle());
     }
     if (!$controller instanceof \Magento\Catalog\Controller\Product\View\ViewInterface) {
         throw new \Magento\Framework\Exception\LocalizedException(__('Bad controller interface for showing product'));
     }
     // Prepare data
     $productHelper = $this->_catalogProduct;
     if (!$params) {
         $params = new \Magento\Framework\DataObject();
     }
     // Standard algorithm to prepare and render product view page
     $product = $productHelper->initProduct($productId, $controller, $params);
     if (!$product) {
         throw new \Magento\Framework\Exception\NoSuchEntityException(__('Product is not loaded'));
     }
     $buyRequest = $params->getBuyRequest();
     if ($buyRequest) {
         $productHelper->prepareProductOptions($product, $buyRequest);
     }
     if ($params->hasConfigureMode()) {
         $product->setConfigureMode($params->getConfigureMode());
     }
     $this->_eventManager->dispatch('catalog_controller_product_view', ['product' => $product]);
     $this->_catalogSession->setLastViewedProductId($product->getId());
     if (in_array($defaultActionHandle, $handles)) {
         $resultPage->addDefaultHandle();
     }
     $this->initProductLayout($resultPage, $product, $params);
     return $this;
 }
开发者ID:Doability,项目名称:magento2dev,代码行数:57,代码来源:View.php

示例4: getDefaultLayoutHandle

 /**
  * Retrieve the default layout handle name for the current action
  *
  * @return string
  */
 public function getDefaultLayoutHandle()
 {
     return $this->page->getDefaultLayoutHandle();
 }
开发者ID:IlyaGluschenko,项目名称:test001,代码行数:9,代码来源:View.php


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