Public Member Functions | |
applyHandle ($pageLayout) | |
applyTemplate ($pageLayout=null) | |
getCurrentPageLayout () | |
Protected Member Functions | |
_getConfig () |
Definition at line 34 of file Layout.php.
_getConfig | ( | ) | [protected] |
Retrieve page config
Definition at line 117 of file Layout.php.
00118 { 00119 return Mage::getSingleton('page/config'); 00120 }
applyHandle | ( | $ | pageLayout | ) |
Apply page layout handle
string | $pageLayout |
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)
string | $pageLayout |
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
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 }