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


PHP Mage_Core_Controller_Varien_Action::getLayout方法代码示例

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


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

示例1: _renderPage

 /**
  * Renders CMS page
  *
  * @param Mage_Core_Controller_Front_Action $action
  * @param integer $pageId
  * @param bool $renderLayout
  * @return boolean
  */
 protected function _renderPage(Mage_Core_Controller_Varien_Action $action, $pageId = null, $renderLayout = true)
 {
     $page = Mage::getSingleton('cms/page');
     if (!is_null($pageId) && $pageId !== $page->getId()) {
         $delimeterPosition = strrpos($pageId, '|');
         if ($delimeterPosition) {
             $pageId = substr($pageId, 0, $delimeterPosition);
         }
         $page->setStoreId(Mage::app()->getStore()->getId());
         if (!$page->load($pageId)) {
             return false;
         }
     }
     if (!$page->getId()) {
         return false;
     }
     $inRange = Mage::app()->getLocale()->isStoreDateInInterval(null, $page->getCustomThemeFrom(), $page->getCustomThemeTo());
     if ($page->getCustomTheme()) {
         if ($inRange) {
             list($package, $theme) = explode('/', $page->getCustomTheme());
             Mage::getSingleton('core/design_package')->setPackageName($package)->setTheme($theme);
         }
     }
     $action->getLayout()->getUpdate()->addHandle('default')->addHandle('cms_page');
     $action->addActionLayoutHandles();
     if ($page->getRootTemplate()) {
         $handle = $page->getCustomRootTemplate() && $page->getCustomRootTemplate() != 'empty' && $inRange ? $page->getCustomRootTemplate() : $page->getRootTemplate();
         $action->getLayout()->helper('page/layout')->applyHandle($handle);
     }
     Mage::dispatchEvent('cms_page_render', array('page' => $page, 'controller_action' => $action));
     $action->loadLayoutUpdates();
     $layoutUpdate = $page->getCustomLayoutUpdateXml() && $inRange ? $page->getCustomLayoutUpdateXml() : $page->getLayoutUpdateXml();
     $action->getLayout()->getUpdate()->addUpdate($layoutUpdate);
     $action->generateLayoutXml()->generateLayoutBlocks();
     $contentHeadingBlock = $action->getLayout()->getBlock('page_content_heading');
     if ($contentHeadingBlock) {
         $contentHeadingBlock->setContentHeading($page->getContentHeading());
     }
     if ($page->getRootTemplate()) {
         $action->getLayout()->helper('page/layout')->applyTemplate($page->getRootTemplate());
     }
     foreach (array('catalog/session', 'checkout/session') as $class_name) {
         $storage = Mage::getSingleton($class_name);
         if ($storage) {
             $action->getLayout()->getMessagesBlock()->addMessages($storage->getMessages(true));
         }
     }
     if ($renderLayout) {
         $action->renderLayout();
     }
     return true;
 }
开发者ID:evinw,项目名称:project_bloom_magento,代码行数:60,代码来源:Page.php

示例2: testAddActionLayoutHandles

 /**
  * @magentoAppIsolation enabled
  */
 public function testAddActionLayoutHandles()
 {
     $this->_model->getRequest()->setRouteName('test')->setControllerName('controller')->setActionName('action');
     $this->_model->addActionLayoutHandles();
     $handles = $this->_model->getLayout()->getUpdate()->getHandles();
     $this->assertContains('test_controller_action', $handles);
 }
开发者ID:relue,项目名称:magento2,代码行数:10,代码来源:ActionTest.php

示例3: _renderPage

 /**
  * Renders CMS page
  *
  * @param Mage_Core_Controller_Front_Action|Mage_Core_Controller_Varien_Action $action
  * @param integer $pageId
  * @param bool $renderLayout
  * @return boolean
  */
 protected function _renderPage(Mage_Core_Controller_Varien_Action $action, $pageId = null, $renderLayout = true)
 {
     $page = Mage::getSingleton('Mage_Cms_Model_Page');
     if (!is_null($pageId) && $pageId !== $page->getId()) {
         $delimeterPosition = strrpos($pageId, '|');
         if ($delimeterPosition) {
             $pageId = substr($pageId, 0, $delimeterPosition);
         }
         $page->setStoreId(Mage::app()->getStore()->getId());
         if (!$page->load($pageId)) {
             return false;
         }
     }
     if (!$page->getId()) {
         return false;
     }
     $inRange = Mage::app()->getLocale()->isStoreDateInInterval(null, $page->getCustomThemeFrom(), $page->getCustomThemeTo());
     if ($page->getCustomTheme()) {
         if ($inRange) {
             Mage::getDesign()->setDesignTheme($page->getCustomTheme());
         }
     }
     $action->addPageLayoutHandles(array('id' => $page->getIdentifier()));
     $action->addActionLayoutHandles();
     if ($page->getRootTemplate()) {
         $handle = $page->getCustomRootTemplate() && $page->getCustomRootTemplate() != 'empty' && $inRange ? $page->getCustomRootTemplate() : $page->getRootTemplate();
         $action->getLayout()->helper('Mage_Page_Helper_Layout')->applyHandle($handle);
     }
     Mage::dispatchEvent('cms_page_render', array('page' => $page, 'controller_action' => $action));
     $action->loadLayoutUpdates();
     $layoutUpdate = $page->getCustomLayoutUpdateXml() && $inRange ? $page->getCustomLayoutUpdateXml() : $page->getLayoutUpdateXml();
     if (!empty($layoutUpdate)) {
         $action->getLayout()->getUpdate()->addUpdate($layoutUpdate);
     }
     $action->generateLayoutXml()->generateLayoutBlocks();
     $contentHeadingBlock = $action->getLayout()->getBlock('page_content_heading');
     if ($contentHeadingBlock) {
         $contentHeading = $this->escapeHtml($page->getContentHeading());
         $contentHeadingBlock->setContentHeading($contentHeading);
     }
     if ($page->getRootTemplate()) {
         $action->getLayout()->helper('Mage_Page_Helper_Layout')->applyTemplate($page->getRootTemplate());
     }
     /* @TODO: Move catalog and checkout storage types to appropriate modules */
     $messageBlock = $action->getLayout()->getMessagesBlock();
     foreach (array('Mage_Catalog_Model_Session', 'Mage_Checkout_Model_Session', 'Mage_Customer_Model_Session') as $storageType) {
         $storage = Mage::getSingleton($storageType);
         if ($storage) {
             $messageBlock->addStorageType($storageType);
             $messageBlock->addMessages($storage->getMessages(true));
         }
     }
     if ($renderLayout) {
         $action->renderLayout();
     }
     return true;
 }
开发者ID:natxetee,项目名称:magento2,代码行数:65,代码来源:Page.php

示例4: _getAddressBlockHtml

 /**
  * Render the suggestions block to be added into the response.
  * @param Mage_Core_Controller_Varien_Action $controller
  * @return string - rendered block
  */
 protected function _getAddressBlockHtml(Mage_Core_Controller_Varien_Action $controller)
 {
     $layout = $controller->getLayout();
     $update = $layout->getUpdate();
     $update->load('checkout_onepage_address_suggestions');
     $layout->generateXml();
     $layout->generateBlocks();
     $output = $layout->getOutput();
     return $output;
 }
开发者ID:WinstonN,项目名称:magento-retail-order-management,代码行数:15,代码来源:Observer.php

示例5: testAddPageLayoutHandles

 /**
  * @magentoAppIsolation enabled
  */
 public function testAddPageLayoutHandles()
 {
     $this->_model->getRequest()->setRouteName('test')->setControllerName('controller')->setActionName('action');
     //$this->_model->addPageLayoutHandles(array());
     $this->assertEmpty($this->_model->getLayout()->getUpdate()->getHandles());
     $this->_model->getRequest()->setRouteName('catalog')->setControllerName('product')->setActionName('view');
     $this->_model->addPageLayoutHandles(array('type' => 'simple'));
     $handles = $this->_model->getLayout()->getUpdate()->getHandles();
     $this->assertContains('default', $handles);
     $this->assertContains('catalog_product_view', $handles);
     $this->assertContains('catalog_product_view_type_simple', $handles);
 }
开发者ID:NatashaOlut,项目名称:Mage_Test,代码行数:15,代码来源:Action.php

示例6: _getMinicartHtml

 /**
  * Retrieve the minicart_head block's html
  * @param Mage_Core_Controller_Varien_Action $controllerAction the request's controller
  * @return string
  */
 protected function _getMinicartHtml($controllerAction)
 {
     $controllerAction->loadLayout();
     $sidebar = $controllerAction->getLayout()->getBlock('minicart_head');
     if ($sidebar) {
         $sidebarHtml = Mage::getSingleton('core/url')->sessionUrlVar($sidebar->toHtml());
         return '<div class="header-minicart minicart--fixed">' . $sidebarHtml . '</div>';
     }
     return '';
 }
开发者ID:sdinteractive,项目名称:SomethingDigital_AjaxAddToCart,代码行数:15,代码来源:Observer.php

示例7: _getMinicartHtml

 /**
  * Retrieve the minicart_head block's html
  * @param Mage_Core_Controller_Varien_Action $controllerAction the request's controller
  * @return string
  */
 protected function _getMinicartHtml($controllerAction)
 {
     $controllerAction->loadLayout();
     $sidebar = $controllerAction->getLayout()->getBlock('minicart_head')->toHtml();
     return '<div class="header-minicart minicart--fixed">' . $sidebar . '</div>';
 }
开发者ID:cooper85,项目名称:SomethingDigital_AjaxAddToCart,代码行数:11,代码来源:Observer.php


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