You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
minor #2235 [TwigComponent][Docs] Fix outerblock markup example (tobiasberge)
This PR was merged into the 2.x branch.
Discussion
----------
[TwigComponent][Docs] Fix outerblock markup example
| Q | A
| ------------- | ---
| Bug fix? | yes
| New feature? | no
| Issues | See below...
| License | MIT
I was following the guide for nested UX components and inheritance. Really cool stuff. 👍
[Inheritance & Forwarding "Outer Blocks"](https://symfony.com/bundles/ux-twig-component/current/index.html#inheritance-forwarding-outer-blocks)
I was confused about this code example that re-uses the alert component and "passes through" the content text from the `SuccessAlert` component usage:
```twig
{# templates/components/SuccessAlert.html.twig #}
<twig:Alert type="success">
{% component Alert with {type: 'success'} %}
{{ block(outerBlocks.content) }}
</twig:Alert>
```
Is it really supposed to be two nested alert components? Because this throws an error because of the missing `{% endcomponent %}` tag.
Should it be either this...
```twig
{# templates/components/SuccessAlert.html.twig #}
<twig:Alert type="success">
{{ block(outerBlocks.content) }}
</twig:Alert>
```
or this syntax?
```twig
{# templates/components/SuccessAlert.html.twig #}
{% component Alert with {type: 'success'} %}
{{ block(outerBlocks.content) }}
{% endcomponent %}
```
Commits
-------
dd1bc4e Change component usage inside inheritance example
0 commit comments