Posted by quicksketch on May 8, 2011 at 5:23am
2 followers
| Project: | Webform |
| Version: | 7.x-3.x-dev |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
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.
Comments
#1
This 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.
#2
Well 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.
#3
Automatically closed -- issue fixed for 2 weeks with no activity.