本文整理匯總了PHP中Magento\Framework\View\Layout::getChildBlocks方法的典型用法代碼示例。如果您正苦於以下問題:PHP Layout::getChildBlocks方法的具體用法?PHP Layout::getChildBlocks怎麽用?PHP Layout::getChildBlocks使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\View\Layout
的用法示例。
在下文中一共展示了Layout::getChildBlocks方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testGetChildBlocks
public function testGetChildBlocks()
{
$parentName = 'parent';
$childrenArray = ['block_name' => 'value1'];
$this->structureMock->expects($this->once())
->method('getChildren')
->with($this->equalTo($parentName))
->will($this->returnValue($childrenArray));
$blockMock = $this->getMockBuilder('Magento\Framework\View\Element\AbstractBlock')
->disableOriginalConstructor()
->getMockForAbstractClass();
$this->structureMock->expects($this->once())
->method('createStructuralElement')
->with(
'block_name',
\Magento\Framework\View\Layout\Element::TYPE_BLOCK,
'Magento\Framework\View\Element\AbstractBlock'
)->willReturn('block_name');
$this->generatorBlockMock->expects($this->once())->method('createBlock')->will($this->returnValue($blockMock));
$this->assertSame(
$blockMock,
$this->model->createBlock('Magento\Framework\View\Element\AbstractBlock', 'block_name', [])
);
$this->assertSame(['value1' => $blockMock], $this->model->getChildBlocks($parentName));
}
示例2: testGetChildBlocks
/**
* @magentoAppIsolation enabled
*/
public function testGetChildBlocks()
{
$this->_layout->addContainer('parent', 'Parent');
$block1 = $this->_layout->addBlock('Magento\\Framework\\View\\Element\\Text', 'block1', 'parent');
$this->_layout->addContainer('container', 'Container', [], 'parent');
$block2 = $this->_layout->addBlock('Magento\\Framework\\View\\Element\\Template', 'block2', 'parent');
$this->assertSame(['block1' => $block1, 'block2' => $block2], $this->_layout->getChildBlocks('parent'));
}
示例3: getChildBlocks
/**
* {@inheritdoc}
*/
public function getChildBlocks($parentName)
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'getChildBlocks');
if (!$pluginInfo) {
return parent::getChildBlocks($parentName);
} else {
return $this->___callPlugins('getChildBlocks', func_get_args(), $pluginInfo);
}
}