Skip to content

Fix Typo in Context / Variables Inside of Blocks doc #1134

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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