Comparison
- Themable Forms (started in September 2016 by lauriii) is older than formdazzle (started September 2019 by JohnAlbin).
- Themable forms has very few commits and amounts to two template suggestion hooks inside the *.module file providing the following suggestions:
form-element.html.twig
form-element--[form-id]--[element-type].html.twig form-element--form-id--[form-id].html.twig form-element--type--[element-type].html.twig form-element.html.twigform-element-label.html.twig
form-element-label--[form_id]--[element_type].html.twig form-element-label--form-id--[form_id].html.twig form-element-label--type--[element_type].html.twig form-element-label.html.twigThe rest of the functions in the *.module file deal with exposing variables (like
#form_id) to be available to these two template suggestion hooks.There are no template suggestions for form.html.twig.
There are no template suggestions for input.html.twig.
- Formdazzle! on the other, hand has many many commits and takes a different approach. It uses the *.module file to register a preprocess_form_element() function, but all the module's business logic is housed in a PHP Class called Dazzler.php. The class has unit tests whereas Themable Forms has no tests (due to its simplistic nature).
Template suggestions are provided for:
form.html.twig - special case logic for webforms and views exposed forms
form--views--[view-id]--[display-id].html.twig form--webform-[webform-id].html.twig form--[form-id].html.twig form.html.twigform-element.html.twig
TBD (see project page for examples)[element-type]--[form-id]--[form-element-name].html.twigform-element-label.html.twig
TBD (see project page for examples)[element-type]--[form-id]--[form-element-name].html.twiginput.html.twig
input--textfield--webform-contact.html.twig input--textfield--webform-contact--first-name.html.twig input--textfield.html.twig input.html.twig
Original Summary by @hawkeye.twolf
Honest question, is Formdazzle! significantly different from Themable forms? I see that the theme suggestions themselves have a slightly different syntax, but are there deeper functionality differences? If so, it would be great to have those documented on the project page. Thank you John!
Comments
Comment #2
hawkeye.twolfComment #3
hawkeye.twolfRelated issue on Themeable forms.
Comment #4
jwilson3Comment #5
jwilson3whoops. I linked the issue to itself. this should fix it
Comment #6
jwilson3Here is a first stab at a comparison of formdazzle and Themable Forms.
This comes from a quick high-level review of examples on formdazzle!'s project page as well as reading the codebase of each module.
So far, it is looking like formdazzle does have more features than themable forms.
Comment #7
jwilson3Comment #8
jwilson3Comment #9
smustgrave commentedThe one suggestion that I needed came from themeable_forms.
form-element--type--[element-type].html.twig
Wonder if formdazzle would consider adding that as I do like that formdazzle has a few more commits and marked stable.
Comment #10
smustgrave commentedWonder if this can be closed now? Or maybe this is worth putting some entry in the README?
Comment #12
smustgrave commentedActually decided to do that so everyone here can get credit for answering the question.