-
-
Notifications
You must be signed in to change notification settings - Fork 364
[Twig] Tweaking docs for new HTML syntax #799
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
[Twig] Tweaking docs for new HTML syntax #799
Conversation
Thanks @weaverryan! Looks good to me! 😁 |
// withActions will be set to true | ||
<twig:Alert type="info" message="hello!" withActions /> | ||
|
||
To pass in a dynamic value, prefix the attribute with ``:`` or use the |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just asking ... is this convention based on the :
prefix imposed somehow to us? Otherwise, it looks strange to introduce this new convention when we all know and use the {{ ... }}
to output the value of variables or expressions. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's borrowed from Vue, and also is used Blade Components. I agree that it feels like an "extra" thing, but it's also a very common syntax to see.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And you can still use the {{ ... }}
, the :
is just a small shortcut.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, so this is a very common syntax outside of Symfony. Then, it makes sense to have it too. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, I found that it is more or less "needed" when you want to pass non-string values - like booleans or arrays:
<twig:Alert :showClose="false" :messages="['hello', 'world']" />
Passing Props as HTML Attributes | ||
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ | ||
|
||
Passing props is done with HTML attributes. For example if you have this component:: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Passing props is done with HTML attributes. For example if you have this component:: | |
Passing props is done with HTML attributes. For example if you have this component: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@jdreesen actually, the double ::
is needed. We use RST format instead of Markdown. code blocks are declared as .. code-block:: php
. But since we have so many PHP code blocks, it's boring to do that. That's why we use a RST trick to tell it that any code following two ::
is to be considered as PHP code.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I didn't know that. Thx for the explanation.
3fee544
to
6691401
Compare
Just following up with a few more tweaks to @WebMamba's docs in #792.
Cheers!