0

An API return object like this

[attr] => stdClass Object
   (
       [id] => 555
       [ttl] => 360
       [aa-type] => NS
       [prio] => 9
   )

In my twig template, in FOR, how i can get aa-type ?

{{ value.attr.id }} -> ok
{{ value.attr.aa-type }} -> Nok because "-"

1 Answers1

1

To access attributes on an object with special characters you can use the attribute function

{{ attribute(value.attr, 'aa-type') }}

Chris Haas
  • 50,516
  • 12
  • 134
  • 260