Skip to main content
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
Bumped by Community user
removed tags from title
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

How todo I set multiple attributes in Twig in a nice way?

If I have multiple attributes that I want to set to an element in a twig template it can get quite long since each attribute requires setAttribute(attribute name, attribute value).

Based on my ircIRC conversation  (don'tI don't remember who it was), it looks like it is not possible to set multiple attributes at once, like it is possible with css classCSS classes.

So I would like to know what would be a "pretty" way of setting multiple attributes in a twig template?

. I presume a loop of some kind...

How to set multiple attributes in Twig in a nice way?

If I have multiple attributes that I want to set to an element in a twig template it can get quite long since each attribute requires setAttribute(attribute name, attribute value).

Based on my irc conversation(don't remember who it was) it looks like it is not possible to set multiple attributes at once, like it is possible with css class.

So I would like to know what would be a "pretty" way of setting multiple attributes in a twig template?

I presume a loop of some kind...

How do I set multiple attributes?

If I have multiple attributes that I want to set to an element in a twig template it can get quite long since each attribute requires setAttribute(attribute name, attribute value).

Based on my IRC conversation  (I don't remember who it was), it looks like it is not possible to set multiple attributes at once, like it is possible with CSS classes.

So I would like to know what would be a "pretty" way of setting multiple attributes in a twig template. I presume a loop of some kind.

Source Link
user21641
user21641

How to set multiple attributes in Twig in a nice way?

If I have multiple attributes that I want to set to an element in a twig template it can get quite long since each attribute requires setAttribute(attribute name, attribute value).

Based on my irc conversation(don't remember who it was) it looks like it is not possible to set multiple attributes at once, like it is possible with css class.

So I would like to know what would be a "pretty" way of setting multiple attributes in a twig template?

I presume a loop of some kind...