本文整理汇总了PHP中Mage_Core_Block_Abstract::unsetChild方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Block_Abstract::unsetChild方法的具体用法?PHP Mage_Core_Block_Abstract::unsetChild怎么用?PHP Mage_Core_Block_Abstract::unsetChild使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Mage_Core_Block_Abstract
的用法示例。
在下文中一共展示了Mage_Core_Block_Abstract::unsetChild方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSetGetUnsetChild
public function testSetGetUnsetChild()
{
$layout = Mage::app()->getLayout();
$this->_block->setLayout($layout);
// regular block
$blockOne = new Mage_Core_Block_Template();
$nameOne = uniqid('block.');
$blockOne->setNameInLayout($nameOne);
$layout->setBlock($nameOne, $blockOne);
$this->_block->setChild('block1', $blockOne);
$this->assertSame($blockOne, $this->_block->getChild('block1'));
// block factory name
$blockTwo = new Mage_Core_Block_Template();
$blockTwo->setLayout($layout);
$blockTwo->setChild('block2', $nameOne);
$this->assertSame($blockOne, $blockTwo->getChild('block2'));
// anonymous block
$blockThree = new Mage_Core_Block_Template();
$blockThree->setIsAnonymous(true);
$this->_block->setChild('block3', $blockThree);
$this->assertSame($blockThree, $this->_block->getChild('block3'));
// unset
$this->_block->unsetChild('block3');
$this->assertNotSame($blockThree, $this->_block->getChild('block3'));
$this->_block->insert($blockOne, '', true, 'block1');
$this->assertContains($nameOne, $this->_block->getSortedChildren());
$this->_block->unsetChild('block1');
$this->assertNotSame($blockOne, $this->_block->getChild('block1'));
$this->assertNotContains($nameOne, $this->_block->getSortedChildren());
}
示例2: setParentBlock
public function setParentBlock(Mage_Core_Block_Abstract $block)
{
$block->unsetChild('save_button');
return parent::setParentBlock($block);
}