In #1405114: Add support for Webform's "number" component, we added a new generic API for "mapping" Webform components to form API properties, plus identifying where we can save properties in the Webform component and place the configuration form in Form Builder. Essentially, this means that we can remove most of our callback forms, including:
- form_builder_webform_property_date_timezone_form
- form_builder_webform_property_date_year_start_form
- form_builder_webform_property_date_year_end_form
- form_builder_webform_property_date_year_textfield_form
- form_builder_webform_property_date_datepicker_form
- form_builder_webform_property_webform_file_filtering_form
- form_builder_webform_property_webform_file_scheme_form
- form_builder_webform_property_webform_file_directory_form
- form_builder_webform_property_webform_file_progress_indicator_form
- form_builder_webform_property_webform_file_width_form
- form_builder_webform_property_grid_optrand_form
- form_builder_webform_property_grid_qrand_form
- form_builder_webform_property_time_timezone_form
- form_builder_webform_property_time_hourformat_form
We'll also be able to get rid of a number of *_load() and *_save() callbacks. A few components (like selects and grids) may still need the full flexibility of the old hooks, plus I think it's good to have a direct line into Form Builder's own hooks, so we can leave all the existing functionality in place, though the new approach is quite a bit more succinct.
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | form_builder_webform_cleanup-d6.patch | 35.72 KB | quicksketch |
| #1 | form_builder_webform_cleanup-d7.patch | 38.58 KB | quicksketch |
Comments
Comment #1
quicksketchHere's an initial pass at this functionality. Disappointingly, there isn't actually any savings in terms of lines of code. However the new approach has less overall *code*, in terms of characters and line-length. I think it also removes a lot of the messy type checking and handling of elements, though it adds essentially another layer of abstraction.
Some other changes contained in this patch:
- The "display_title" property is now pulled directly from the Webform component configuration form, instead of using Form Builder's built-in implementation. This effectively rolls back #1223880: Webform integration does not show correct title display options for textareas or grids and replaces it with an alternative approach.
- The "File" component upload button is disabled in D7.
- The $element['#webform_component'] key is now always guaranteed to exist, thanks to the Webform issue #1405374: Ensure #webform_component property always exists. This means that we can stop using our fake $element['#webform'] property and consistently use the same property.
Comment #2
quicksketchEverything seems to still be in working order. I actually turned up a few other bugs while testing:
#1405956: Default values of "0" for checkboxes and radios not saved
#1405954: The "Custom keys" option is not remembered for checkboxes/select/radios
But we can take care of those issues separately. They appear to be pre-existing issues, unrelated to these changes. Committed to both branches.