Twig icon indicating copy to clipboard operation
Twig copied to clipboard

Twig, the flexible, fast, and secure template language for PHP

Results 200 Twig issues
Sort by recently updated
recently updated
newest added

With the popularity of [Twig Component HTML Syntax](https://symfony.com/bundles/ux-twig-component/current/index.html#component-html-syntax) I wanted to discuss the possibility of adding an official html lexer in Twig core. What we're doing in twig components is...

I'd like to discuss adding a new function, let's say `attr()`, to make juggling with HTML attributes easier. I'm willing to work on the implementation given that the general idea...

Closes #3907. First, it adds a `attr_merge` filter. This filter is intended to be used with arrays that represent HTML attribute name-value pairs. Basically, it works like `|merge`, but for...

Example usage: ```twig {# required #} {%- set text = text -%} {# optional #} {%- set id = id|default(null) -%} {%- set skin = skin|default('primary') -%} {%- set type...

Once upon a time I had to find out why a twig template is slow (350ms). In my SPX icicle graph I saw `twig_get_attribute` being used quite often and is...

Except if I miss something, there is no documentation for the `` operator even though it is mentioned in both Twig 2 and 3 documentation: https://twig.symfony.com/doc/2.x/templates.html#expressions https://twig.symfony.com/doc/3.x/templates.html#expressions

```twig {{ (5 has every v => v == 4 and v == "foo") ? 'Every' : 'Not every' }} v is equal to both 4 and "foo" ``` Outputs:...

Whenever we try to spread an integer, we get this error about the `merge` filter. https://twigfiddle.com/ud26jf > The merge filter only works with arrays or "Traversable", got "integer" for argument...

According to the [documentation of the autoescape tag](https://twig.symfony.com/doc/3.x/tags/autoescape.html): > Twig is smart enough to not escape an already escaped value by the [escape](https://twig.symfony.com/doc/3.x/filters/escape.html) filter. But, when testing TwigPHP, it seems...

Consider the following template: ```twig {% set br = "" %} {% autoescape false %} {% autoescape 'html' %} {{ true ? "" : br }} {{ true ? (true...