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


PHP Mage_Core_Block_Template::getChild方法代码示例

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


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

示例1: getChildDataHtml

 function getChildDataHtml($name, $attributes = array())
 {
     $child_block = parent::getChild($name);
     foreach ($attributes as $field => $value) {
         $child_block->setData($field, $value);
     }
     return $child_block->toHtml();
 }
开发者ID:kiutisuperking,项目名称:eatsmartboxdev,代码行数:8,代码来源:Default.php

示例2: 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());
 }
开发者ID:relue,项目名称:magento2,代码行数:30,代码来源:AbstractTest.php


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