Right now, you're only creating a Field. You could create a form API element (with hook_element_info()) that can be used by other forms, not just in Fields. The Field could then use that form API element and everybody would be so happy.
| Comment | File | Size | Author |
|---|---|---|---|
| #3 | timefield-form_element-1931962-3.patch | 12.21 KB | tien.xuan.vo |
Comments
Comment #1
wesnick commentedI agree this would be nice to have. I think the element would be unwieldy, however, since it would require a huge number of properties, for example:
Comment #2
rudiedirkx commentedThat's fine, isn't it? Use good, sensible defaults. Most of those options never have to change. Whether to display a 24 or 12 hour clock would be the most used probably.
Comment #3
tien.xuan.vo commentedHere is the patch. I'm not good in form API and field API, so it just work.
This patch is for 1.0-alpha2.
Here is how to use it:
$form['my_timefield'] = array(
'#title' => t('Timefield'),
'#type' => 'timefield',
'#weight' => '0',
);
Comment #4
nicxvan commentedThis patchworks!
Comment #5
nicxvan commentedComment #6
rv0 commented+1 for this functionality.
The project I need this sadly can't rely on a patched 3rd party module to work, so I'll roll my own time field for now.
But I'll considering switching if this code gets committed.
Comment #7
rcodinaPatch on #3 doesn't apply on latest dev version of module.