本文整理匯總了PHP中Magento\Framework\View\Element\UiComponentInterface::renderChildComponent方法的典型用法代碼示例。如果您正苦於以下問題:PHP UiComponentInterface::renderChildComponent方法的具體用法?PHP UiComponentInterface::renderChildComponent怎麽用?PHP UiComponentInterface::renderChildComponent使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Magento\Framework\View\Element\UiComponentInterface
的用法示例。
在下文中一共展示了UiComponentInterface::renderChildComponent方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: compile
/**
* Compiles the Element node
*
* @param Compiler $compiler
* @param \DOMElement $node
* @param UiComponentInterface $component
* @param Object $context
* @return void
*/
public function compile(Compiler $compiler, \DOMElement $node, UiComponentInterface $component, Object $context)
{
$name = $node->getAttribute('name');
$content = (string) $component->renderChildComponent($name);
$name .= '_' . sprintf('%x', crc32(spl_object_hash($context)));
if (!empty($content)) {
$compiler->setPostprocessingData($name, $content);
$newNode = $node->ownerDocument->createTextNode(Compiler::PATTERN_TAG . $name . Compiler::PATTERN_TAG);
$node->parentNode->replaceChild($newNode, $node);
} else {
$node->parentNode->removeChild($node);
}
}
示例2: compile
/**
* Compiles the Element node
*
* @param Compiler $compiler
* @param \DOMElement $node
* @param UiComponentInterface $component
* @param Object $context
* @return void
*/
public function compile(Compiler $compiler, \DOMElement $node, UiComponentInterface $component, Object $context)
{
$result = $component->renderChildComponent($node->getAttribute('name'));
if ($result instanceof Result) {
$node->parentNode->replaceChild($result->getDocumentElement(), $node);
} else {
if (!empty($result) && is_scalar($result)) {
$newFragment = $node->ownerDocument->createDocumentFragment();
$newFragment->appendXML($result);
$node->parentNode->replaceChild($newFragment, $node);
$node->parentNode->removeChild($node);
} else {
$node->parentNode->removeChild($node);
}
}
}