What is the difference between <action method=”unsetChild”>
and <remove name=""/>
?
Both functions are used to remove a block from the layout.
Could someone explain with an example?
blockslayouttheme
What is the difference between <action method=”unsetChild”>
and <remove name=""/>
?
Both functions are used to remove a block from the layout.
Could someone explain with an example?
Best Answer
<remove name="" />
operates in the global block scope ofMage_Core_Model_Layout
. These are collected inMage_Core_Model_Layout::generateXml()
and used to prevent the block with the specified name from even being instantiated. Also, any child blocks declared for a<remove />
ed block will also not be instantiated.<action method="" />
a.k.aMage_Core_Block_Abstract::unsetChild()
is a block-level method which de-lists the indicated child block (by alias, not by name) from the parent block instance on which the action is being called. This most often results in the block "disappearing" from the rendered output, even though the block instance is still created. Used in combination with the::append()
or::insert()
methods, it is used to perform a "move".