本文整理汇总了PHP中Magento\Framework\View\Result\Page::initLayout方法的典型用法代码示例。如果您正苦于以下问题:PHP Page::initLayout方法的具体用法?PHP Page::initLayout怎么用?PHP Page::initLayout使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Magento\Framework\View\Result\Page
的用法示例。
在下文中一共展示了Page::initLayout方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: loadLayout
/**
* {@inheritdoc}
*/
public function loadLayout($handles = null, $generateBlocks = true, $generateXml = true, $addActionHandles = true)
{
if ($this->_isLayoutLoaded) {
throw new \RuntimeException('Layout must be loaded only once.');
}
// if handles were specified in arguments load them first
if (!empty($handles)) {
$this->getLayout()->getUpdate()->addHandle($handles);
}
if ($addActionHandles) {
// add default layout handles for this action
$this->page->initLayout();
}
$this->loadLayoutUpdates();
if (!$generateXml) {
return $this;
}
$this->generateLayoutXml();
if (!$generateBlocks) {
return $this;
}
$this->generateLayoutBlocks();
$this->_isLayoutLoaded = true;
return $this;
}
示例2: initLayout
/**
* {@inheritdoc}
*/
public function initLayout()
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'initLayout');
if (!$pluginInfo) {
return parent::initLayout();
} else {
return $this->___callPlugins('initLayout', func_get_args(), $pluginInfo);
}
}
示例3: testInitLayoutLayoutDefined
public function testInitLayoutLayoutDefined()
{
$handleDefault = 'default';
$fullActionName = 'full_action_name';
$this->request->expects($this->any())->method('getFullActionName')->will($this->returnValue($fullActionName));
$this->layoutMerge->expects($this->at(0))->method('addHandle')->with($handleDefault)->willReturnSelf();
$this->layoutMerge->expects($this->at(1))->method('addHandle')->with($fullActionName)->willReturnSelf();
$this->layoutMerge->expects($this->at(2))->method('isLayoutDefined')->willReturn(true);
$this->layoutMerge->expects($this->at(3))->method('removeHandle')->with($handleDefault)->willReturnSelf();
$this->assertEquals($this->page, $this->page->initLayout());
}