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:
- Ensuring there is a custom-elements enabled route, e.g. by cloning the original one and
adding
custom_elementsas_format. - Pointing the custom-elements enabled route to a form controller that renders the results as custom elements. For standard forms, 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 theCustomElementsFormControllerTrait, see thelupus_decoupled_contactsubmodule for an example.
That's it!
Generally, The Lupus Decoupled Contact module serves as a simple example that demonstrates how support for contact forms is enabled.