Files
Twig/tests/Fixtures/exceptions/child_print_outside_blocks.test
2026-06-11 07:43:46 +02:00

18 lines
529 B
Plaintext

--TEST--
Exception for child templates printing content outside blocks defined by parent
--TEMPLATE--
{% extends 'base.twig' %}
{{ content }}
{% block sidebar %}
Content inside a block.
{% endblock %}
--TEMPLATE(base.twig)--
{% block sidebar %}
{% endblock %}
--DATA--
return ['content' => 'Content outside a block.'];
--EXCEPTION--
Twig\Error\SyntaxError: A template that extends another one cannot include content outside Twig blocks. Did you forget to put the content inside a {% block %} tag in "index.twig" at line 4?