Embed registration form via twig?

Created on 18 September 2023, about 1 year ago
Updated 23 September 2023, about 1 year ago

Is it possible the embed the registration form within a twig template?

Something like: {{ node.fields.field_event_registration }} ?

πŸ’¬ Support request
Status

Closed: works as designed

Version

3.0

Component

Registration Core

Created by

πŸ‡ΊπŸ‡ΈUnited States todea

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • 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
  • πŸ‡ΊπŸ‡ΈUnited States john.oltman
Production build 0.71.5 2024