function petreference_widget_info in Previewable email templates 6
Implementation of hook_widget_info().
We need custom handling of multiple values for the petreference_select widget 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 value.
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/
petreference/ petreference.module, line 335 - Defines a field type for referencing pet template to a node.
Code
function petreference_widget_info() {
return array(
'petreference_select' => array(
'label' => t('Select list'),
'field types' => array(
'petreference',
),
'multiple values' => CONTENT_HANDLE_MODULE,
'callbacks' => array(
'default value' => CONTENT_CALLBACK_DEFAULT,
),
),
'petreference_buttons' => array(
'label' => t('Check boxes/radio buttons'),
'field types' => array(
'petreference',
),
'multiple values' => CONTENT_HANDLE_MODULE,
'callbacks' => array(
'default value' => CONTENT_CALLBACK_DEFAULT,
),
),
'petreference_autocomplete' => array(
'label' => t('Autocomplete text field'),
'field types' => array(
'petreference',
),
'multiple values' => CONTENT_HANDLE_CORE,
'callbacks' => array(
'default value' => CONTENT_CALLBACK_DEFAULT,
),
),
);
}