Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Magento: Block unsetChild for all children?

I am aware of:

<action method="unsetChild"><name>as</name></action>

Is it possible to remove all children in one line? e.g:

<action method="unsetChild"><name>*</name></action>

Or something similar..?

UPDATE - ANSWER:

<action method="unsetChildren"/>

Seems to do the trick reasonably well..

like image 467
user76568 Avatar asked Dec 08 '13 16:12

user76568


1 Answers

Don't be afraid to read the source file of the base block class.

#File: app/code/core/Mage/Core/Block/Abstract.php
public function unsetChildren()
{
    $this->_children       = array();
    $this->_sortedChildren = array();
    return $this;
}

Myriad answers in those methods.

like image 198
Alan Storm Avatar answered Oct 21 '22 18:10

Alan Storm