Commit 05ad23f
committed
bug #534 [Twig] Allow more flexible twig expressions as component attributes (veewee)
This PR was merged into the 2.x branch.
Discussion
----------
[Twig] Allow more flexible twig expressions as component attributes
| Q | A
| ------------- | ---
| Bug fix? | no
| New feature? | yes
| Tickets |
| License | MIT
We noticed it is only possible to pass an ArrayExpression as twig component attributes.
This is not convenient of you want to e.g. merge 2 arrays in twig.
Example Use-case: if you want to create a custom form template that consists out of twig components, it is not possible to merge the form attributes into the attributes of your twig component.
```twig
{%- block button_widget -%}
{% component 'atoms:button' with attrs|merge({theme: 'primary'}) %}
{% block children %}
{{ label }}
{% endblock children %}
{% endcomponent %}
{%- endblock button_widget -%}
```
Commits
-------
9ef4c5d Allow more flexible twig expressions as component attributesFile tree
4 files changed
+32
-2
lines changed- src/TwigComponent
- src/Twig
- tests
- Fixtures/templates
- Integration
4 files changed
+32
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
| 7 | + | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
| |||
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
19 | | - | |
| 19 | + | |
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| |||
Lines changed: 7 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
Lines changed: 2 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
Lines changed: 21 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
44 | 44 | | |
45 | 45 | | |
46 | 46 | | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
47 | 68 | | |
48 | 69 | | |
49 | 70 | | |
| |||
0 commit comments