mirror of
https://github.com/twigphp/Twig.git
synced 2026-09-18 13:26:37 +00:00
Fix bug
This commit is contained in:
@@ -155,6 +155,16 @@ abstract class YieldingTemplate extends Template
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function renderParentBlock($name, array $context, array $blocks = [])
|
||||||
|
{
|
||||||
|
$content = '';
|
||||||
|
foreach ($this->yieldParentBlock($name, $context, $blocks) as $data) {
|
||||||
|
$content .= $data;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $content;
|
||||||
|
}
|
||||||
|
|
||||||
public function displayBlock($name, array $context, array $blocks = [], $useBlocks = true, Template $templateContext = null)
|
public function displayBlock($name, array $context, array $blocks = [], $useBlocks = true, Template $templateContext = null)
|
||||||
{
|
{
|
||||||
throw new RuntimeError(sprintf('Calling "%s" for block "%s" is not supported as "use_yield" is set to "true".', __METHOD__, $name), -1, $this->getSourceContext());
|
throw new RuntimeError(sprintf('Calling "%s" for block "%s" is not supported as "use_yield" is set to "true".', __METHOD__, $name), -1, $this->getSourceContext());
|
||||||
@@ -165,11 +175,6 @@ abstract class YieldingTemplate extends Template
|
|||||||
throw new RuntimeError(sprintf('Calling "%s" for block "%s" is not supported as "use_yield" is set to "true".', __METHOD__, $name), -1, $this->getSourceContext());
|
throw new RuntimeError(sprintf('Calling "%s" for block "%s" is not supported as "use_yield" is set to "true".', __METHOD__, $name), -1, $this->getSourceContext());
|
||||||
}
|
}
|
||||||
|
|
||||||
public function renderParentBlock($name, array $context, array $blocks = [])
|
|
||||||
{
|
|
||||||
throw new RuntimeError(sprintf('Calling "%s" for block "%s" is not supported as "use_yield" is set to "true".', __METHOD__, $name), -1, $this->getSourceContext());
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function displayWithErrorHandling(array $context, array $blocks = [])
|
protected function displayWithErrorHandling(array $context, array $blocks = [])
|
||||||
{
|
{
|
||||||
throw new RuntimeError(sprintf('Calling "%s" is not supported as "use_yield" is set to "true".', __METHOD__), -1, $this->getSourceContext());
|
throw new RuntimeError(sprintf('Calling "%s" is not supported as "use_yield" is set to "true".', __METHOD__), -1, $this->getSourceContext());
|
||||||
|
|||||||
@@ -0,0 +1,11 @@
|
|||||||
|
--TEST--
|
||||||
|
"block" calling parent() in a conditional expression
|
||||||
|
--TEMPLATE--
|
||||||
|
{% extends "parent.twig" %}
|
||||||
|
{% block label %}{{ parent() ?: 'foo' }}{% endblock %}
|
||||||
|
--TEMPLATE(parent.twig)--
|
||||||
|
{% block label %}PARENT_LABEL{% endblock %}
|
||||||
|
--DATA--
|
||||||
|
return []
|
||||||
|
--EXPECT--
|
||||||
|
PARENT_LABEL
|
||||||
Reference in New Issue
Block a user