3

Is there a way to determine which blocks are attached to a handle and/or what child-blocks a block have?

8

To get all handles see Mage_Core_Model_Layout_Update::getHandles()

For example inside a controller you can use it for debugging purposes like:

Zend_Debug::dump($this->getLayout()->getUpdate()->getHandles());

Note: use it after loadLayout or loadLayoutUpdates call

To get all block children see Mage_Core_Block_Abstract::getChild() without parameters Note: the getChild() returns all child blocks as an object so used something like

Zend_Debug::dump(array_keys($block->getChild())) 

and you get an array with child block alias names

and if you want to see more about a block use

Zend_Debug::dump($block->getChild($aliasName))
  • 1
    And use $this->getLayout()->getUpdate->addHandle('handle') or ...addHandle(array('handle','other_handle')) to load a specific handle for dumping. – benmarks Jul 2 '13 at 18:52
2

Try the following free extension which is very handy in debugging:http://www.magentocommerce.com/magento-connect/magento-debug-8676.html

  • Very handy indeed! – ruuter Apr 18 '13 at 11:35
0

I think I might figured out the answer and it is pretty simple. Just search by handle or block name from all files in layout folder :)

  • Would be nice if someone could confirm this being conclusive. – ruuter Apr 18 '13 at 7:33
  • 2
    Searching in the layout files for a layout handle or reference tags for a block in question is likely to return all the blocks you are interested in, but it's worth noting that it won't take into account those blocks created 'on the fly' through a call to the createBlock() method on the layout object. – Jonathan Hussey Apr 18 '13 at 10:25
  • I knew there was something more :) Tnx! You should make it an answer. – ruuter Apr 18 '13 at 11:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.