【问题标题】:Magento: Block unsetChild for all children?Magento:阻止所有孩子的 unsetChild?
【发布时间】:2013-12-25 16:31:50
【问题描述】:

我知道:

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

是否可以删除一行中的所有子项?例如:

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

或者类似的东西..?

更新 - 答案:

<action method="unsetChildren"/>

似乎做得相当好..

【问题讨论】:

    标签: magento layout block unset


    【解决方案1】:

    不要害怕阅读基块类的源文件。

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

    这些方法有无数的答案。

    【讨论】:

    • @AlanStrom 我确实阅读了源代码,这就是为什么我用答案更新了我的问题(在你发布答案前一小时):)
    • 浏览器标签——它们保持打开状态。
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2012-09-07
    • 1970-01-01
    • 1970-01-01
    • 2019-04-18
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多