本文整理匯總了PHP中Magento\Framework\View\Layout::renderElement方法的典型用法代碼示例。如果您正苦於以下問題:PHP Layout::renderElement方法的具體用法?PHP Layout::renderElement怎麽用?PHP Layout::renderElement使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\View\Layout
的用法示例。
在下文中一共展示了Layout::renderElement方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: testRenderElementDoNotDisplay
/**
* @param mixed $displayValue
* @dataProvider renderElementDoNotDisplayDataProvider
*/
public function testRenderElementDoNotDisplay($displayValue)
{
$displayValue = 'false';
$name = 'test_container';
$blockHtml = '';
$this->structureMock->expects($this->atLeastOnce())->method('getAttribute')->willReturnMap([[$name, 'display', $displayValue]]);
$this->assertEquals($blockHtml, $this->model->renderElement($name, false));
}
示例2: testUpdateContainerAttributes
public function testUpdateContainerAttributes()
{
$this->_layout->setXml(simplexml_load_file(__DIR__ . '/_files/layout/container_attributes.xml', 'Magento\\Framework\\View\\Layout\\Element'));
$this->_layout->generateElements();
$result = $this->_layout->renderElement('container1', false);
$this->assertEquals('<div id="container1-2" class="class12">Test11Test12</div>', $result);
$result = $this->_layout->renderElement('container2', false);
$this->assertEquals('<div id="container2-2" class="class22">Test21Test22</div>', $result);
}
示例3: renderElement
/**
* {@inheritdoc}
*/
public function renderElement($name, $useCache = true)
{
$pluginInfo = $this->pluginList->getNext($this->subjectType, 'renderElement');
if (!$pluginInfo) {
return parent::renderElement($name, $useCache);
} else {
return $this->___callPlugins('renderElement', func_get_args(), $pluginInfo);
}
}