Mage_Page_Helper_Layout Class Reference

Inheritance diagram for Mage_Page_Helper_Layout:

Mage_Core_Helper_Abstract

List of all members.

Public Member Functions

 applyHandle ($pageLayout)
 applyTemplate ($pageLayout=null)
 getCurrentPageLayout ()

Protected Member Functions

 _getConfig ()


Detailed Description

Definition at line 34 of file Layout.php.


Member Function Documentation

_getConfig (  )  [protected]

Retrieve page config

Returns:
Mage_Page_Model_Config

Definition at line 117 of file Layout.php.

00118     {
00119         return Mage::getSingleton('page/config');
00120     }

applyHandle ( pageLayout  ) 

Apply page layout handle

Parameters:
string $pageLayout
Returns:
Mage_Page_Helper_Layout

Definition at line 42 of file Layout.php.

00043     {
00044         $pageLayout = $this->_getConfig()->getPageLayout($pageLayout);
00045 
00046         if (!$pageLayout) {
00047             return $this;
00048         }
00049 
00050         $this->getLayout()
00051             ->getUpdate()
00052             ->addHandle($pageLayout->getLayoutHandle());
00053 
00054         return $this;
00055     }

applyTemplate ( pageLayout = null  ) 

Apply page layout template (for old design packages)

Parameters:
string $pageLayout
Returns:
Mage_Page_Helper_Layout

Definition at line 64 of file Layout.php.

00065     {
00066         if ($pageLayout === null) {
00067             $pageLayout = $this->getCurrentPageLayout();
00068         } else {
00069             $pageLayout = $this->_getConfig()->getPageLayout($pageLayout);
00070         }
00071 
00072         if (!$pageLayout) {
00073             return $this;
00074         }
00075 
00076         if ($this->getLayout()->getBlock('root') &&
00077             !$this->getLayout()->getBlock('root')->getIsHandle()) {
00078                 // If not applied handle
00079                 $this->getLayout()
00080                     ->getBlock('root')
00081                     ->setTemplate($pageLayout->getTemplate());
00082         }
00083 
00084         return $this;
00085     }

getCurrentPageLayout (  ) 

Retrieve current applied page layout

Returns:
Varien_Object|boolean

Definition at line 92 of file Layout.php.

00093     {
00094         // All loaded handles
00095         $handles = $this->getLayout()->getUpdate()->getHandles();
00096         // Handles used in page layouts
00097         $pageLayoutHandles = $this->_getConfig()->getPageLayoutHandles();
00098         // Applied page layout handles
00099         $appliedHandles = array_intersect($handles, $pageLayoutHandles);
00100 
00101         if (empty($appliedHandles)) {
00102             return false;
00103         }
00104 
00105         $currentHandle = array_pop($appliedHandles);
00106 
00107         $layoutCode = array_search($currentHandle, $pageLayoutHandles, true);
00108 
00109         return $this->_getConfig()->getPageLayout($layoutCode);
00110     }


The documentation for this class was generated from the following file:

Generated on Sat Jul 4 17:24:30 2009 for Magento by  doxygen 1.5.8