Experimental project
This is a sandbox project, which contains experimental code for developer use only.
Customizing the markup for very simple forms should be, well, very simple.
Twig FAPI is an experiment to explore possible answers for questions like:
- Is it possible to render fully-working, highly customized, (simple) forms, by overriding only the form-level template?
- Is it possible to get a template for a form to live in a styleguide/prototype, and then be re-used by Drupal?
Currently, Twig FAPI provides:
- render_to_attributes(): takes a form element and builds an Attribute() object with attributes generated by Drupal core, as well as trigger a $renderer_service->render() for the #attached properties of the element.
Examples
This sandbox includes a submodule (twig_fapi_examples), which demonstrates how to use this approach.
Current Status
- Very much a proof of concept, twig_fapi_examples module shows a simple form supporting both normal and AJAX submission.
- Only tested with an email and submit elements. Other elements still to be evaluated/tested.
- Not yet tested on Drupal 10.
Other Utilities for Themeing Forms
- Formdazzle!: injects various suggestions so templates can target specific forms or elements in a given form.
Supporting organizations:
Initial development
Project information
Minimally maintained
Maintainers monitor issues, but fast responses are not guaranteed.- Project categories: Developer tools
- Created by jedihe on , updated
