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()); }
public function setParentBlock(Mage_Core_Block_Abstract $block) { $block->unsetChild('save_button'); return parent::setParentBlock($block); }