本文整理匯總了PHP中Magento\Framework\View\Layout::addOutputElement方法的典型用法代碼示例。如果您正苦於以下問題:PHP Layout::addOutputElement方法的具體用法?PHP Layout::addOutputElement怎麽用?PHP Layout::addOutputElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\View\Layout
的用法示例。
在下文中一共展示了Layout::addOutputElement方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testProcessWithExceptions
/**
* @magentoAppIsolation enabled
*/
public function testProcessWithExceptions()
{
\Magento\TestFramework\Helper\Bootstrap::getObjectManager()->get('Magento\\Framework\\App\\State')->setMode(State::MODE_DEFAULT);
$this->layout->generateElements();
$this->layout->addOutputElement('block.with.broken.constructor');
$this->layout->addOutputElement('block.with.broken.layout');
$this->layout->addOutputElement('block.with.broken.action');
$this->assertEmpty($this->layout->getOutput());
}
示例2: testGetOutput
/**
* @covers \Magento\Framework\View\Layout::addOutputElement
* @covers \Magento\Framework\View\Layout::getOutput
* @covers \Magento\Framework\View\Layout::removeOutputElement
*/
public function testGetOutput()
{
$blockName = 'block_' . __METHOD__;
$expectedText = "some_text_for_{$blockName}";
$block = $this->_layout->addBlock('Magento\\Framework\\View\\Element\\Text', $blockName);
$block->setText($expectedText);
$this->_layout->addOutputElement($blockName);
// add the same element twice should not produce output duplicate
$this->_layout->addOutputElement($blockName);
$this->assertEquals($expectedText, $this->_layout->getOutput());
$this->_layout->removeOutputElement($blockName);
$this->assertEmpty($this->_layout->getOutput());
}
示例3: testAddRemoveOutputElement
public function testAddRemoveOutputElement()
{
$this->assertSame($this->model, $this->model->addOutputElement('name'));
$this->assertSame($this->model, $this->model->removeOutputElement('name'));
}
示例4: addOutputElement
/**
* {@inheritdoc}
*/
public function addOutputElement($name)
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'addOutputElement');
if (!$pluginInfo) {
return parent::addOutputElement($name);
} else {
return $this->___callPlugins('addOutputElement', func_get_args(), $pluginInfo);
}
}