- Issue created by @todea
- πΊπΈUnited States john.oltman
{{ content.field_event_registration }}
is all you need as long as the field is included in the node display (Manage Display in Drupal admin for the node content type and whatever display the template is outputting) and the field formatter chosen there is "Registration form". - πΊπΈUnited States todea
I'm using layout builder and I have the the registration field in the layout, formatter is set to "Registration form". The form does show on the page based on my setup with layout builder but when I try to place it using twig it doesn't work. I'm using a custom page node template file: page--event.html.twig
{{ content.field_event_registration }}
doesn't give me anything. I had previously tried other combinations. Attached is screenshot of the dump output. - πΊπΈUnited States john.oltman
Is there some reason why layout builder cannot be used? Trying to understand the motivation. Seems like you have a solution in hand already. There are ways to do it with a template but more complicated.
- πΊπΈUnited States john.oltman
Following up -
{{ content.field_event_registration }}
is intended for use in a node template, not a page template. Printing node fields directly in a page template is not advisable. I would create a node template and print the form there. - πΊπΈUnited States todea
Thanks for the help. I created a node template (node--event.html.twig) and added
{{ content.field_event_registration }}
but still no luck.It does work if I turn off layout builder for this content type. So I'll stick with doing it that way. In some cases I find it to be more flexible to control the layout and output directly via a twig template.
- Status changed to Closed: works as designed
about 1 year ago 5:30pm 23 September 2023