Skip to content

Commit

Permalink
Fix Typo in Context / Variables Inside of Blocks doc
Browse files Browse the repository at this point in the history
Some `block content` are missing in the classic syntax.
  • Loading branch information
rdavaillaud authored Sep 22, 2023
1 parent d15c67e commit 8975a6b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/TwigComponent/doc/index.rst
Original file line number Diff line number Diff line change
Expand Up @@ -906,9 +906,11 @@ the component you're now rendering *and* you have access to all of that componen
{{ this.someFunction }} {# this refers to SuccessAlert #}
{% component Alert with { type: 'success' } %}
{{ this.someFunction }} {# this refers to Alert! #}
{% block content %}
{{ this.someFunction }} {# this refers to Alert! #}
{{ type }} {# references a "type" prop from Alert #}
{{ type }} {# references a "type" prop from Alert #}
{% endblock %}
{% endcomponent %}
Conveniently, in addition to the variables from the ``Alert`` component, you still have
Expand All @@ -919,7 +921,9 @@ access to whatever variables are available in the original template:
{# templates/SuccessAlert.html.twig #}
{% set name = 'Fabien' %}
{% component Alert with { type: 'success' } %}
Hello {{ name }}
{% block content %}
Hello {{ name }}
{% endblock %}
{% endcomponent %}
Note that ALL variables from upper components (e.g. ``SuccessAlert``) are available to lower
Expand Down

0 comments on commit 8975a6b

Please # to comment.