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


PHP Mage_Core_Block_Abstract::getChildHtml方法代码示例

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


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

示例1: testGetChildHtml

 /**
  * @covers Mage_Core_Block_Abstract::getChildHtml
  * @covers Mage_Core_Block_Abstract::getChildChildHtml
  */
 public function testGetChildHtml()
 {
     // Without layout
     $this->assertEmpty($this->_block->getChildHtml());
     $this->assertEmpty($this->_block->getChildHtml('block'));
     // With layout
     $parent = $this->_createBlockWithLayout('parent', 'parent');
     $blockOne = $this->_createBlockWithLayout('block1', 'block1', 'Mage_Core_Block_Text');
     $blockTwo = $this->_createBlockWithLayout('block2', 'block2', 'Mage_Core_Block_Text');
     $blockOne->setText('one');
     $blockTwo->setText('two');
     $parent->insert($blockTwo, '-', false, 'block2');
     // make block2 1st
     $parent->insert($blockOne, '-', false, 'block1');
     // make block1 1st
     $this->assertEquals('one', $parent->getChildHtml('block1'));
     $this->assertEquals('two', $parent->getChildHtml('block2'));
     // Sorted will render in the designated order
     $this->assertEquals('onetwo', $parent->getChildHtml('', true, true));
     // GetChildChildHtml
     $blockTwo->setChild('block11', $blockOne);
     $this->assertEquals('one', $parent->getChildChildHtml('block2'));
     $this->assertEquals('', $parent->getChildChildHtml(''));
     $this->assertEquals('', $parent->getChildChildHtml('block3'));
 }
开发者ID:nemphys,项目名称:magento2,代码行数:29,代码来源:AbstractTest.php

示例2: 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

示例3: injectChildBlocks

 /**
  * Inject child blocks
  *
  * @param $source
  * @param Mage_Core_Block_Abstract $block
  * @return mixed
  */
 public function injectChildBlocks($source, Mage_Core_Block_Abstract $block)
 {
     $count = null;
     $source = preg_replace_callback('/<!--\\s*###(.+)###\\s*-->(.*)<!--\\s*###\\/\\1###\\s*-->/s', function ($matches) use($block) {
         //if (Mage::getIsDeveloperMode()) {
         //    Mage::log('[Aoe_TemplateImport] Injecting block: ' . $matches[1]);
         //}
         return '<!-- BEGIN BLOCK: ' . $matches[1] . ' -->' . $block->getChildHtml($matches[1]) . '<!-- END BLOCK: ' . $matches[1] . ' -->';
     }, $source, -1, $count);
     //if (Mage::getIsDeveloperMode()) {
     //    Mage::log('[Aoe_TemplateImport] Match count: ' . $count);
     //}
     return $source;
 }
开发者ID:aoepeople,项目名称:aoe_templateimport,代码行数:21,代码来源:Source.php

示例4: getActionHtml

 /**
  * @param Mage_Core_Block_Abstract $block
  * @return string
  */
 public function getActionHtml($block)
 {
     $html = '';
     $actions = $block->getChildGroup('actions');
     uasort($actions, array($this, 'compareBySortOrder'));
     foreach ($actions as $alias => $action) {
         /* @var $action Mana_Admin_Block_Action */
         $params = $action->getData();
         $this->copyParam($params, 'title', 'label');
         $action->setData($params);
         $html .= $block->getChildHtml($alias);
     }
     return $html;
 }
开发者ID:xiaoguizhidao,项目名称:cupboardglasspipes.ecomitize.com,代码行数:18,代码来源:Page.php


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