Overview

Packages

  • currencysymbol
  • MAbout
  • Mage
    • Admin
    • Adminhtml
    • AdminNotification
    • Api
    • Api2
    • Authorizenet
    • Backup
    • Bundle
    • Captcha
    • Catalog
    • CatalogIndex
    • CatalogInventory
    • CatalogRule
    • CatalogSearch
    • Centinel
    • Checkout
    • Cms
    • Compiler
    • Connect
    • Contacts
    • Core
    • Cron
    • CurrencySymbol
    • Customer
    • Dataflow
    • Directory
    • DirtectPost
    • Downloadable
    • Eav
    • GiftMessage
    • GoogleAnalytics
    • GoogleBase
    • GoogleCheckout
    • ImportExport
    • Index
    • Install
    • Log
    • Media
    • Newsletter
    • Oauth
    • Page
    • PageCache
    • Paygate
    • Payment
    • Paypal
    • PaypalUk
    • Persistent
    • Poll
    • ProductAlert
    • Rating
    • Reports
    • Review
    • Rss
    • Rule
    • Sales
    • SalesRule
    • Sedfriend
    • Sendfriend
    • Shipping
    • Sitemap
    • Tag
    • Tax
    • Usa
    • Weee
    • Widget
    • Wishlist
    • XmlConnect
  • None
  • Phoenix
    • Moneybookers
  • PHP
  • Zend
    • Date
    • Mime
    • XmlRpc

Classes

  • Mage_Catalog_Block_Seo_Sitemap_Tree_Pager
  • Mage_Page_Block_Html
  • Mage_Page_Block_Html_Breadcrumbs
  • Mage_Page_Block_Html_Footer
  • Mage_Page_Block_Html_Head
  • Mage_Page_Block_Html_Header
  • Mage_Page_Block_Html_Notices
  • Mage_Page_Block_Html_Pager
  • Mage_Page_Block_Html_Topmenu
  • Mage_Page_Block_Html_Welcome
  • Mage_Page_Block_Html_Wrapper
  • Mage_Page_Block_Js_Cookie
  • Mage_Page_Block_Redirect
  • Mage_Page_Helper_Data
  • Mage_Page_Helper_Html
  • Mage_Page_Helper_Layout
  • Mage_Page_Model_Config
  • Mage_Page_Model_Source_Layout
  • Overview
  • Package
  • Class
  • Tree
  1: <?php
  2: /**
  3:  * Magento
  4:  *
  5:  * NOTICE OF LICENSE
  6:  *
  7:  * This source file is subject to the Open Software License (OSL 3.0)
  8:  * that is bundled with this package in the file LICENSE.txt.
  9:  * It is also available through the world-wide-web at this URL:
 10:  * http://opensource.org/licenses/osl-3.0.php
 11:  * If you did not receive a copy of the license and are unable to
 12:  * obtain it through the world-wide-web, please send an email
 13:  * to license@magentocommerce.com so we can send you a copy immediately.
 14:  *
 15:  * DISCLAIMER
 16:  *
 17:  * Do not edit or add to this file if you wish to upgrade Magento to newer
 18:  * versions in the future. If you wish to customize Magento for your
 19:  * needs please refer to http://www.magentocommerce.com for more information.
 20:  *
 21:  * @category    Mage
 22:  * @package     Mage_Page
 23:  * @copyright   Copyright (c) 2012 Magento Inc. (http://www.magentocommerce.com)
 24:  * @license     http://opensource.org/licenses/osl-3.0.php  Open Software License (OSL 3.0)
 25:  */
 26: 
 27: /**
 28:  * Page layout config model
 29:  *
 30:  * @category   Mage
 31:  * @package    Mage_Page
 32:  * @author     Magento Core Team <core@magentocommerce.com>
 33:  */
 34: class Mage_Page_Model_Config
 35: {
 36:     const XML_PATH_PAGE_LAYOUTS = 'global/page/layouts';
 37:     const XML_PATH_CMS_LAYOUTS = 'global/cms/layouts';
 38: 
 39:     /**
 40:      * Available page layouts
 41:      *
 42:      * @var array
 43:      */
 44:     protected $_pageLayouts = null;
 45: 
 46:     /**
 47:      * Initialize page layouts list
 48:      *
 49:      * @return Mage_Page_Model_Config
 50:      */
 51:     protected function _initPageLayouts()
 52:     {
 53:         if ($this->_pageLayouts === null) {
 54:             $this->_pageLayouts = array();
 55:             $this->_appendPageLayouts(self::XML_PATH_CMS_LAYOUTS);
 56:             $this->_appendPageLayouts(self::XML_PATH_PAGE_LAYOUTS);
 57:         }
 58:         return $this;
 59:     }
 60: 
 61:     /**
 62:      * Fill in $_pageLayouts by reading layouts from config
 63:      *
 64:      * @param string $xmlPath XML path to layouts root
 65:      * @return Mage_Page_Model_Config
 66:      */
 67:     protected function _appendPageLayouts($xmlPath)
 68:     {
 69:         if (!Mage::getConfig()->getNode($xmlPath)) {
 70:             return $this;
 71:         }
 72:         if (!is_array($this->_pageLayouts)) {
 73:             $this->_pageLayouts = array();
 74:         }
 75:         foreach (Mage::getConfig()->getNode($xmlPath)->children() as $layoutCode => $layoutConfig) {
 76:             $this->_pageLayouts[$layoutCode] = new Varien_Object(array(
 77:                 'label'         => Mage::helper('page')->__((string)$layoutConfig->label),
 78:                 'code'          => $layoutCode,
 79:                 'template'      => (string)$layoutConfig->template,
 80:                 'layout_handle' => (string)$layoutConfig->layout_handle,
 81:                 'is_default'    => (int)$layoutConfig->is_default,
 82:             ));
 83:         }
 84:         return $this;
 85:     }
 86: 
 87:     /**
 88:      * Retrieve available page layouts
 89:      *
 90:      * @return array
 91:      */
 92:     public function getPageLayouts()
 93:     {
 94:         $this->_initPageLayouts();
 95:         return $this->_pageLayouts;
 96:     }
 97: 
 98:     /**
 99:      * Retrieve page layout by code
100:      *
101:      * @param string $layoutCode
102:      * @return Varien_Object|boolean
103:      */
104:     public function getPageLayout($layoutCode)
105:     {
106:         $this->_initPageLayouts();
107: 
108:         if (isset($this->_pageLayouts[$layoutCode])) {
109:             return $this->_pageLayouts[$layoutCode];
110:         }
111: 
112:         return false;
113:     }
114: 
115:     /**
116:      * Retrieve page layout handles
117:      *
118:      * @return array
119:      */
120:     public function getPageLayoutHandles()
121:     {
122:         $handles = array();
123: 
124:         foreach ($this->getPageLayouts() as $layout) {
125:             $handles[$layout->getCode()] = $layout->getLayoutHandle();
126:         }
127: 
128:         return $handles;
129:     }
130: }
131: 
Magento 1.7.0.2 API documentation generated by ApiGen 2.8.0