mirror of
https://github.com/twigphp/Twig.git
synced 2026-08-18 03:31:41 +00:00
Fix nested block() resolution when a directly rendered block calls parent()
This commit is contained in:
@@ -0,0 +1,28 @@
|
||||
--TEST--
|
||||
#3321 block() resolves nested block() calls against the overriding template even when going through parent()
|
||||
--TEMPLATE--
|
||||
{{ block('block1', 'theme.html.twig') }}
|
||||
--TEMPLATE(theme.html.twig)--
|
||||
{% extends 'base.html.twig' %}
|
||||
|
||||
{%- block block1 -%}
|
||||
{{- parent() -}}
|
||||
BLOCK1THEME/
|
||||
{%- endblock -%}
|
||||
|
||||
{%- block block2 -%}
|
||||
BLOCK2THEME/
|
||||
{%- endblock -%}
|
||||
--TEMPLATE(base.html.twig)--
|
||||
{%- block block1 -%}
|
||||
BLOCK1BASE/
|
||||
{{- block('block2') -}}
|
||||
{%- endblock -%}
|
||||
|
||||
{%- block block2 -%}
|
||||
BLOCK2BASE/
|
||||
{%- endblock -%}
|
||||
--DATA--
|
||||
return []
|
||||
--EXPECT--
|
||||
BLOCK1BASE/BLOCK2THEME/BLOCK1THEME/
|
||||
Reference in New Issue
Block a user