Fabien Potencier
9d2d35faa7
Make extra integration tests compatible with Twig 4
2026-09-06 22:35:36 +02:00
Dylan Pulver
c072ff85b3
Fix html_attr dropping style declarations whose value is zero
...
InlineStyle::getValue() skipped a declaration when empty($value) was true,
which also matches 0, 0.0 and '0'. Those are ordinary CSS values (opacity: 0,
z-index: 0, margin: 0, flex-grow: 0), so they were silently dropped, and a
style map containing only such declarations omitted the attribute entirely.
The sibling SeparatedTokenList::getValue() already uses an explicit
null/false test, so class token lists keep a 0 while style declarations did
not. The numeric-key branch of InlineStyle itself never consulted empty(),
so {style: ['opacity: 0']} printed while {style: {opacity: 0}} did not.
2026-09-03 20:24:11 +03:00
Hugo Alliaume
9b18e3757d
Extract htmlAttrValue() from html_attr for standalone attribute rendering
2026-08-26 16:46:53 +02:00
Fabien Potencier
9c6d76b61c
Add void return type hint even in tests
2026-07-12 13:43:08 +02:00
Fabien Potencier
9323a82eb9
Render backed enums using their backing value in the html_attr function
2026-06-25 08:50:01 +02:00
Matthias Pigulla
25bfb5957c
Add two tests for error conditions in #3930
2026-03-17 08:24:08 +01:00
Matthias Pigulla
42c12fa720
Add an html_attr function to make outputting HTML attributes easier
2026-03-17 07:39:33 +01:00
Nicolas Lemoine
8158dabc17
Add support for Twig\Markup
...
Co-authored-by: Fabien Potencier <fabien@potencier.org >
2024-12-29 11:29:59 +01:00
Fabien Potencier
2a6c986e85
Add a test
2024-12-18 07:46:55 +01:00
Fabien Potencier
4e08e3ef5f
Fix tests
2024-09-30 08:41:48 +02:00
Alexander M. Turek
18f4203827
Prepare IntegrationTestCase for static data providers
2024-09-03 15:08:40 +02:00
Matheo Daninos
e3ac14e1c8
Introduce CVA to html-extra
2024-08-18 09:36:16 +02:00
Ruud Kamphuis
8ef12588ea
Remove escape
2024-08-11 18:59:31 +02:00
Fabien Potencier
68a826cf61
minor #3969 [html-extra] filter classes (kbond)
...
This PR was merged into the 3.x branch.
Discussion
----------
[html-extra] filter classes
A small formatting change to avoid double spaces:
```twig
class="{{ html_classes('a', false ? 'b', true ? 'c') }}"
{# before #}
class="a c"
{# after #}
class="a c"
```
Commits
-------
a517c14f [html-extra] filter classes
2024-04-29 21:43:39 +02:00
Kevin Bond
a517c14f19
[html-extra] filter classes
2024-04-29 21:42:05 +02:00
Fabien Potencier
f7f11ea410
Fix CS
2024-02-10 09:52:03 +01:00
Fabien Potencier
6a18cda5aa
Move functions for HtmlExtension
2023-12-09 18:39:01 +01:00
Fabien Potencier
1868918724
Move things around
2021-01-01 15:53:48 +01:00