At 1st we're starting to make cck widgets for every html5 elements.
We already have the number field in the html5_tools.module file and you can use that as a base for starting the other fields.
If you're interested in what new fields are available take a look at the elements module code, there is not support for email, number, url, color, and range.
Declaring a new widget type.
/**
* Implements hook_field_widget_info().
*/
function html5_tools_field_widget_info() {
return array(
'numberfield' => array( // Machine name of the widget.
'label' => t('Number field'), // The label of the field, this is what's display to the user on the fields management screen.
'field types' => array('number_integer', 'number_decimal', 'number_float'), // The field_types that are allowed to use this widget.
),
);
}After you have the widget code above you just need to add a
/**
* Implements hook_field_widget_form().
*/
function html5_tools_field_widget_form(&$form, &$form_state, $field, $instance, $langcode, $items, $delta, $element) {
....
//
}Examples:
http://api.drupal.org/api/drupal/modules--field--modules--text--text.mod...
http://api.drupal.org/api/drupal/modules--field--modules--number--number...
You will also need a
/**
* Implements hook_field_widget_error().
*/
function html5_tools_field_widget_error($element, $error, $form, &$form_state) {
form_error($element['value'], $error['message']);
}Feel free to edit this wiki to add more info.