Commit 5944258
committed
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 example1 file changed
+0
-1
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
872 | 872 | | |
873 | 873 | | |
874 | 874 | | |
875 | | - | |
876 | 875 | | |
877 | 876 | | |
878 | 877 | | |
| |||
0 commit comments