Skip to content

Commit

Permalink
minor #1134 Fix Typo in Context / Variables Inside of Blocks doc (rda…
Browse files Browse the repository at this point in the history
…vaillaud)

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
  • Loading branch information
weaverryan committed Sep 22, 2023
2 parents d15c67e + 8975a6b commit c3a4e7f
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 c3a4e7f

Please sign in to comment.