-
-
Notifications
You must be signed in to change notification settings - Fork 299
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
[TwigComponent] Parent function does not work in the content of a twig component #1875
Comments
Hi @Nek- ! Not sure why it would be stupid :) .... but it won't work indeed. Twig Components are isolated component, somehow like So the What you tried is similar to doing something like this : {# Your template #}
{% block choice_row %}
{{ include('foo.html.twig') }}
{% endblock %} {# foo.html.twig #}
{{ parent() }} That would not work, as Just beeing curious, what does your "twig:Select" component do ? |
In my point of view, it's far from obvious that the scope change in the code I give an argument to the component. (Maybe I'm used to ReactJS so it does not feel fluid for me). by stupid code I meant very simple that actually does not work My I wanted to use it like this because I'm using the component in other contexts that Symfony forms. |
Ok! So let's try another way to explain :) How would you do the same thing with an embed tag ? :) |
Do you mean this kind of things? (I never used it!) I think by design embedding will not work with such feature. But it's also because it provides different features, like extending the include. Does the twig component element provide any specific feature that conflicts? |
As i tried to explain, TwigComponent are not only twig syntax, they enforce isolation. What i then tried to tell you is that it's normal it would not work, as it would not work either with embed, and TwigComponent with content are some kind of embeds :) But i know i'm not always the best to explain my ideas 😅 |
Hey @Nek- I just created a PR tell me if you think that can be useful 😁 Thanks your report |
I tried the following stupid code:
But the
parent()
function does not work inside a twig component. 😅 It was a bit disturbing. Not sure it's a bug or a feature request to be honest.The text was updated successfully, but these errors were encountered: