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_elements
as_format
. - 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 theCustomElementsFormControllerTrait
, see thelupus_decoupled_contact
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.