function optionwidgets_widget_info in Content Construction Kit (CCK) 6
Same name and namespace in other branches
- 5 optionwidgets.module \optionwidgets_widget_info()
- 6.3 modules/optionwidgets/optionwidgets.module \optionwidgets_widget_info()
- 6.2 modules/optionwidgets/optionwidgets.module \optionwidgets_widget_info()
Implementation of hook_widget_info().
We need custom handling of multiple values because we need to combine them into a options list rather than display multiple elements. We will use the content module's default handling for default values.
Callbacks can be omitted if default handing is used. They're included here just so this module can be used as an example for custom modules that might do things differently.
File
- modules/
optionwidgets/ optionwidgets.module, line 57 - Defines selection, check box and radio button widgets for text and numeric fields.
Code
function optionwidgets_widget_info() {
return array(
'optionwidgets_select' => array(
'label' => t('Select list'),
'field types' => array(
'text',
'number_integer',
'number_decimal',
'number_float',
),
'multiple values' => CONTENT_HANDLE_MODULE,
'callbacks' => array(
'default value' => CONTENT_CALLBACK_DEFAULT,
),
),
'optionwidgets_buttons' => array(
'label' => t('Check boxes/radio buttons'),
'field types' => array(
'text',
'number_integer',
'number_decimal',
'number_float',
),
'multiple values' => CONTENT_HANDLE_MODULE,
'callbacks' => array(
'default value' => CONTENT_CALLBACK_DEFAULT,
),
),
'optionwidgets_onoff' => array(
'label' => t('Single on/off checkbox'),
'field types' => array(
'text',
'number_integer',
'number_decimal',
'number_float',
),
'multiple values' => CONTENT_HANDLE_MODULE,
'callbacks' => array(
'default value' => CONTENT_CALLBACK_DEFAULT,
),
),
);
}