Accessing subfield data in twig

8 June, 2023

You have a compound field with subfields (like the body field) and want to access a subfield in twig? Not a problem.

Let's say your field is field_mystuff and the subfield is url. In twig, you would access it like this:

{{ content.field_mystuff.url }}

 

Login or Register to Comment!