本文整理匯總了PHP中Magento\Framework\View\LayoutInterface::reorderChild方法的典型用法代碼示例。如果您正苦於以下問題:PHP LayoutInterface::reorderChild方法的具體用法?PHP LayoutInterface::reorderChild怎麽用?PHP LayoutInterface::reorderChild使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\View\LayoutInterface
的用法示例。
在下文中一共展示了LayoutInterface::reorderChild方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testReorderChild
/**
* @param \Magento\Framework\View\LayoutInterface $layout
* @depends testSetChild
*/
public function testReorderChild(\Magento\Framework\View\LayoutInterface $layout)
{
$layout->addContainer('four', 'Four', [], 'one');
// offset +1
$layout->reorderChild('one', 'four', 1);
$this->assertSame(['two', 'four', 'three'], $layout->getChildNames('one'));
// offset -2
$layout->reorderChild('one', 'three', 2, false);
$this->assertSame(['two', 'three', 'four'], $layout->getChildNames('one'));
// after sibling
$layout->reorderChild('one', 'two', 'three');
$this->assertSame(['three', 'two', 'four'], $layout->getChildNames('one'));
// after everyone
$layout->reorderChild('one', 'three', '-');
$this->assertSame(['two', 'four', 'three'], $layout->getChildNames('one'));
// before sibling
$layout->reorderChild('one', 'four', 'two', false);
$this->assertSame(['four', 'two', 'three'], $layout->getChildNames('one'));
// before everyone
$layout->reorderChild('one', 'two', '-', false);
$this->assertSame(['two', 'four', 'three'], $layout->getChildNames('one'));
//reorder by sibling alias
$layout->reorderChild('one', 'two', 'three_alias', true);
$this->assertSame(['four', 'three', 'two'], $layout->getChildNames('one'));
}