Skip to content

Commit c3a4e7f

Browse files
committed
minor #1134 Fix Typo in Context / Variables Inside of Blocks doc (rdavaillaud)
This PR was merged into the 2.x branch. Discussion ---------- Fix Typo in Context / Variables Inside of Blocks doc | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | Tickets | | License | MIT Some `block content` are missing in the classic syntax. Commits ------- 8975a6b Fix Typo in Context / Variables Inside of Blocks doc
2 parents d15c67e + 8975a6b commit c3a4e7f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

src/TwigComponent/doc/index.rst

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -906,9 +906,11 @@ the component you're now rendering *and* you have access to all of that componen
906906
{{ this.someFunction }} {# this refers to SuccessAlert #}
907907
908908
{% component Alert with { type: 'success' } %}
909-
{{ this.someFunction }} {# this refers to Alert! #}
909+
{% block content %}
910+
{{ this.someFunction }} {# this refers to Alert! #}
910911
911-
{{ type }} {# references a "type" prop from Alert #}
912+
{{ type }} {# references a "type" prop from Alert #}
913+
{% endblock %}
912914
{% endcomponent %}
913915
914916
Conveniently, in addition to the variables from the ``Alert`` component, you still have
@@ -919,7 +921,9 @@ access to whatever variables are available in the original template:
919921
{# templates/SuccessAlert.html.twig #}
920922
{% set name = 'Fabien' %}
921923
{% component Alert with { type: 'success' } %}
922-
Hello {{ name }}
924+
{% block content %}
925+
Hello {{ name }}
926+
{% endblock %}
923927
{% endcomponent %}
924928
925929
Note that ALL variables from upper components (e.g. ``SuccessAlert``) are available to lower

0 commit comments

Comments
 (0)