function petreference_widget_settings in Previewable email templates 6
Implementation of hook_widget_settings().
File
- modules/
petreference/ petreference.module, line 400 - Defines a field type for referencing pet template to a node.
Code
function petreference_widget_settings($op, $widget) {
switch ($op) {
case 'form':
$form = array();
$match = isset($widget['autocomplete_match']) ? $widget['autocomplete_match'] : 'contains';
$size = isset($widget['size']) && is_numeric($widget['size']) ? $widget['size'] : 60;
if ($widget['type'] == 'petreference_autocomplete') {
$form['autocomplete_match'] = array(
'#type' => 'select',
'#title' => t('Autocomplete matching'),
'#default_value' => $match,
'#options' => array(
'starts_with' => t('Starts with'),
'contains' => t('Contains'),
),
'#description' => t('Select the method used to collect autocomplete suggestions.'),
);
$form['size'] = array(
'#type' => 'textfield',
'#title' => t('Size of textfield'),
'#default_value' => $size,
'#element_validate' => array(
'_element_validate_integer_positive',
),
'#required' => TRUE,
);
}
else {
$form['autocomplete_match'] = array(
'#type' => 'hidden',
'#value' => $match,
);
$form['size'] = array(
'#type' => 'hidden',
'#value' => $size,
);
}
return $form;
case 'save':
return array(
'autocomplete_match',
'size',
);
}
}