function field_example_field_widget_info in Examples for Developers 7
Implements hook_field_widget_info().
Three widgets are provided.
- A simple text-only widget where the user enters the '#ffffff'.
- A 3-textfield widget that gathers the red, green, and blue values separately.
- A farbtastic colorpicker widget that chooses the value graphically.
These widget types will eventually show up in hook_field_widget_form, where we will have to flesh them out.
See also
field_example_field_widget_form()
Related topics
File
- field_example/
field_example.module, line 198 - An example field using the Field Types API.
Code
function field_example_field_widget_info() {
return array(
'field_example_text' => array(
'label' => t('RGB value as #ffffff'),
'field types' => array(
'field_example_rgb',
),
),
'field_example_3text' => array(
'label' => t('RGB text field'),
'field types' => array(
'field_example_rgb',
),
),
'field_example_colorpicker' => array(
'label' => t('Color Picker'),
'field types' => array(
'field_example_rgb',
),
),
);
}