当前位置: 首页>>代码示例>>PHP>>正文


PHP Mage_Core_Block_Abstract::getChildChildHtml方法代码示例

本文整理汇总了PHP中Mage_Core_Block_Abstract::getChildChildHtml方法的典型用法代码示例。如果您正苦于以下问题:PHP Mage_Core_Block_Abstract::getChildChildHtml方法的具体用法?PHP Mage_Core_Block_Abstract::getChildChildHtml怎么用?PHP Mage_Core_Block_Abstract::getChildChildHtml使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Mage_Core_Block_Abstract的用法示例。


在下文中一共展示了Mage_Core_Block_Abstract::getChildChildHtml方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testGetChildHtml

 /**
  * @covers Mage_Core_Block_Abstract::getChildHtml
  * @covers Mage_Core_Block_Abstract::getChildChildHtml
  */
 public function testGetChildHtml()
 {
     $blockOne = new Mage_Core_Block_Text();
     $blockOne->setText('one')->setNameInLayout(uniqid('block.one.'));
     $blockTwo = new Mage_Core_Block_Text();
     $blockTwo->setText('two')->setNameInLayout(uniqid('block.two.'));
     $this->_block->insert($blockTwo, '', false, 'block2');
     // make block2 1st
     $this->_block->insert($blockOne, '', false, 'block1');
     // make block1 1st
     $this->assertEquals('one', $this->_block->getChildHtml('block1'));
     $this->assertEquals('two', $this->_block->getChildHtml('block2'));
     // unsorted children will render in the order they were added
     $this->assertEquals('twoone', $this->_block->getChildHtml());
     // hack: rendering sorted children requires layout
     $layout = new Mage_Core_Model_Layout();
     $this->_block->setLayout($layout);
     $blockOne->setLayout($layout);
     $layout->setBlock($blockOne->getNameInLayout(), $blockOne);
     $blockTwo->setLayout($layout);
     $layout->setBlock($blockTwo->getNameInLayout(), $blockTwo);
     // sorted will render in the designated order
     $this->assertEquals('onetwo', $this->_block->getChildHtml('', true, true));
     // getChildChildHtml
     $blockTwo->setChild('block11', $blockOne);
     $this->assertEquals('one', $this->_block->getChildChildHtml('block2'));
     $this->assertEquals('', $this->_block->getChildChildHtml(''));
     $this->assertEquals('', $this->_block->getChildChildHtml('block3'));
 }
开发者ID:relue,项目名称:magento2,代码行数:33,代码来源:AbstractTest.php

示例2: testGetChildChildHtml

 public function testGetChildChildHtml()
 {
     // Without layout
     $this->assertEmpty($this->_block->getChildChildHtml('alias'));
     // With layout
     $parent1 = $this->_createBlockWithLayout('parent1', 'parent1');
     $parent2 = $this->_createBlockWithLayout('parent2', 'parent2');
     $block1 = $this->_createBlockWithLayout('block1', 'block1', 'Mage_Core_Block_Text');
     $block2 = $this->_createBlockWithLayout('block2', 'block2', 'Mage_Core_Block_Text');
     $block3 = $this->_createBlockWithLayout('block3', 'block3', 'Mage_Core_Block_Text');
     $block4 = $this->_createBlockWithLayout('block4', 'block4', 'Mage_Core_Block_Text');
     $block1->setText('one');
     $block2->setText('two');
     $block3->setText('three');
     $block4->setText('four');
     $parent1->insert($parent2);
     $parent2->insert($block1, '-', false, 'block1');
     $parent2->insert($block2, '-', false, 'block2');
     $parent2->insert($block3, '-', true, 'block3');
     $parent1->insert($block4);
     $this->assertEquals('twoonethree', $parent1->getChildChildHtml('parent2'));
 }
开发者ID:nemphys,项目名称:magento2,代码行数:22,代码来源:AbstractTest.php


注:本文中的Mage_Core_Block_Abstract::getChildChildHtml方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。