Skip to content

Commit 5944258

Browse files
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 example
2 parents c23d756 + dd1bc4e commit 5944258

File tree

1 file changed

+0
-1
lines changed

1 file changed

+0
-1
lines changed

src/TwigComponent/doc/index.rst

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -872,7 +872,6 @@ that's passed to it via the ``outerBlocks`` variable and forward it into ``Alert
872872

873873
{# templates/components/SuccessAlert.html.twig #}
874874
<twig:Alert type="success">
875-
{% component Alert with {type: 'success'} %}
876875
{{ block(outerBlocks.content) }}
877876
</twig:Alert>
878877

0 commit comments

Comments
 (0)