Wednesday 4 June 2014

The layout initialization happens as follows:

  1. 1. Instances of the Layout and Layout Update are created.
  2. 2. Layout handles are added according to the $handles argument if passed.
  3. 3. Store layout handle STORE_[store_code] is added to the Layout Update Instance. For example, if code of current store is en, then layout handle STORE_en is added.
  4. 4. Theme layout handle THEME_[area]_[package]_[layout_theme] is added to the Layout Update Instance. For example, if the page rendered is for the frontend area, the current theme package name is magebase and theme name for layout is modern, then the layout handle THEME_frontend_magebase_modern is added.
  5. 5. Action layout handle is added to the Layout Update Instance. For example, if the page rendered is a category detail page, then Magento is executing catalog module’s category controller’s view action. So it will add an action handle catalog_category_view.
  6. 6. All Layout XML files defined for all active modules are loaded
  7. 7. If a layout file named local.xml exists in the current theme’s layout folder, it is loaded last
  8. 8. Layout updates of all added layout handles from the loaded layout XML are merged
  9. 9. Layout updates of all added layout handles from the database are merged
  10. 10. If the $generateXML argument of loadLayout() method is passed as false, the initialization is finished.
  11. 11. The layout update data is refined by removing all blocks and block references defined with the remove tag. (As discussed in Part 1)
  12. 12. If $generateBlocks argument is passed as false, the initialization is finished.
  13. 13. The instances of block classes are created according to the block definitions in the Layout XML
  14. 14. The methods are called with specified arguments on the blocks where action tags are defined. (As discussed in Part 1)
reference: http://jaseir.com/magento/the-layout-initialization-happens-as-follows/

No comments:

Post a Comment