Closed (fixed)
Project:
Webform
Version:
7.x-3.x-dev
Component:
Code
Priority:
Normal
Category:
Task
Assigned:
Unassigned
Reporter:
Created:
8 May 2011 at 05:23 UTC
Updated:
23 May 2011 at 04:11 UTC
Jump to comment: Most recent file
The time component is currently unique in that it doesn't contain a #process function for expanding its type out from a single field into multiple fields (hour, minute, ampm). This lack of a process function has the effect of making it incompatible with Form Builder, not to mention increasing the definition size of a form when it is initially built. We should switch the time component to use a #process function like other advanced components.
| Comment | File | Size | Author |
|---|---|---|---|
| #2 | webform_time_process-d6.patch | 8.15 KB | quicksketch |
| #2 | webform_time_process-d7.patch | 7.57 KB | quicksketch |
| #1 | webform_time_process-d6.patch | 4.84 KB | quicksketch |
| #1 | webform_time_process-d7.patch | 6.66 KB | quicksketch |
Comments
Comment #1
quicksketchThis was much easier than I expected. A little mysterious as to why we didn't do this earlier. These patches seem to work but the tests aren't passing, a little further work looks necessary here.
Comment #2
quicksketchWell I figured out why this has been difficult in the past. Because Webform time components are not given a specific #type property, they are assumed to be of #type = 'markup'. Because markup fields do not submit a value into POST, #process functions are not run on them (not sure *why* this is the rule, but it seems to be the case in D6). The approach in #1 only worked on D7 where #process functions are always run.
This patch gives the time component a specific element type (#type = 'webform_time'), and implements hook_elements()/hook_element_info() to create these new types. Since these types are only useful within Webform, they only expose the most minimal properties to keep all the logic in the individual component .inc files.
This patch sets us up for converting the Grid component in the same way. This patch passes all tests and my own testing, committed to both branches.