Supporting more Drupal forms

Lupus Decoupled Drupal supports submitting Drupal forms via the decoupled frontend, as documented under Advanced Topics - Drupal Forms. In order to enable submitting another Drupal form on the frontend, a custom-elements enabled form processing route must be added. This is done easily by:

  1. Ensuring there is a custom-elements enabled route, e.g. by cloning the original one and adding custom_elements as _format.
  2. Pointing the custom-elements enabled route to a form controller that renders the results as custom elements. For standard form or entity_form controllers the following controllers may be specified:
  • For general forms: lupus_decoupled_form.controller.form:getContentResult
  • For entity forms: lupus_decoupled_form.controller.entity_form:getContentResult Else, a custom controller can be easily be provided with the help of the CustomElementsFormControllerTrait, see the lupus_decoupled_contact for an example.

That's it!

Generally, https://git.drupalcode.org/project/lupus_decoupled/-/tree/1.x/modules/ serves as a simple example that demonstrates how support for contact forms is enabled.