Layout Loading and Misc Notes

Updated . Posted . Visible to the public.

Layout XML files are loaded here via this stack - here we are loading the layout update for the rwd/default design package, for the CMS home page. I've put a dashed line on the demarcation between layout code and other code:

Mage_Core_Model_App->run(Array)
Mage_Core_Controller_Varien_Front->dispatch()
Mage_Core_Controller_Varien_Router_Standard->match(Mage_Core_Controller_Request_Http)
Mage_Core_Controller_Varien_Action->dispatch('index')
Mage_Cms_IndexController->indexAction()
Mage_Cms_Helper_Page->renderPage(Mage_Cms_IndexController, 'home')
Mage_Cms_Helper_Page->_renderPage(Mage_Cms_IndexController, 'home')
---------------------------------------------------------------------------------------
Mage_Core_Controller_Varien_Action->loadLayoutUpdates()
Mage_Core_Model_Layout_Update->load()
Mage_Core_Model_Layout_Update->merge('default')
Mage_Core_Model_Layout_Update->fetchPackageLayoutUpdates('default')
Mage_Core_Model_Layout_Update->fetchFileLayoutUpdates()
Mage_Core_Model_Layout_Update->getFileLayoutUpdatesXml('frontend', 'rwd', 'default', 1)

The loading of XML files relies on the design package, which is set during Mage_Core_Controller_Varien_Action::preDispatch().

Here are some important layout classes and what they do:

Mage_Core_Model_Layout          - Holds all instantiated blocks, handles block instantiation, via XML or otherwise
Mage_Core_Model_Layout_Update   - Loads and merges layout update XML files
Mage_Core_Model_Design_Package  - Handles loading of design phtml and xml, and skin files, including fallback loading. Merges JS & CSS
Mage_Core_Model_Design_Fallback - Handles the fallback scheme, i.e. where to look first, then second, etc etc
Mike Whitby
Last edit
Mike Whitby
Posted by Mike Whitby to Magento (2014-06-10 08:49)