Closed
Conversation
Member
Author
|
Similar twig core issues/PRs: twigphp/Twig#3930, twigphp/Twig#3907, twigphp/Twig#3760 |
Member
Author
|
The function name <div{{ attributes }}> {# correct #}
<div{{ attributes() }}> {# wrong #}
|
Member
|
That's a great idea, it would also close #940 since the main idea was to easily renders attributes |
Contributor
Yes, I agree here. I like How it's gonna work with Live components for example? <div attributes({role: 'alert', class='text-blue-800 px-4', ...attributes})>
...
</div> |
Contributor
|
Would love to have this in Twig itself :) |
weaverryan
added a commit
that referenced
this pull request
Jan 29, 2024
… (kbond) This PR was merged into the 2.x branch. Discussion ---------- [Twig] Make `ComponentAttributes` traversable/countable | Q | A | ------------- | --- | Bug fix? | no | New feature? | yes | Issues | n/a | License | MIT This will help with #1405 and #1414. Commits ------- 8040d9c feat(twig): make `ComponentAttributes` traversable/countable
Contributor
|
twigphp/Twig#3930 is taking shape, so I'd like to hear if it would fit your needs as well. 🙏🏻 |
Member
|
Replaced by twigphp/Twig#3930 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This allows passing attributes to elements easier.
When/if #1413 is merged, the following will also be possible: