function content_taxonomy_autocomplete_widget_settings in Content Taxonomy 6.2
Same name and namespace in other branches
- 5 content_taxonomy_autocomplete.module \content_taxonomy_autocomplete_widget_settings()
- 6 content_taxonomy_autocomplete.module \content_taxonomy_autocomplete_widget_settings()
Implementation of hook_widget_settings
File
- ./
content_taxonomy_autocomplete.module, line 53 - Defines a widget type for content_taxonomy with autocomplete
Code
function content_taxonomy_autocomplete_widget_settings($op, $widget) {
switch ($op) {
case 'form':
$form['autocomplete'] = array(
'#type' => 'fieldset',
'#title' => t('Settings for Autocompletes'),
'#collapsible' => TRUE,
'#weight' => 10,
);
$form['autocomplete']['new_terms'] = array(
'#type' => 'radios',
'#title' => t('Freetagging settings'),
'#default_value' => isset($widget['new_terms']) ? $widget['new_terms'] : 'insert',
'#options' => array(
'insert' => t('Allow and insert new terms by the user into the vocabulary'),
'deny' => t('Deny any new terms'),
),
);
$form['autocomplete']['extra_parent'] = array(
'#type' => 'select',
'#title' => t('Extra Parent for new terms'),
'#options' => _content_taxonomy_get_all_terms(),
'#default_value' => isset($widget['extra_parent']) && is_numeric($widget['extra_parent']) ? $widget['extra_parent'] : 0,
'#description' => t('This setting is only relevant if you have selected "Allow and insert new terms by the user into the vocabulary". If you select any term here, new terms will get children of the selected one, otherwise new terms get children of the parent term (root, if no parent selected) selected in the global settings.'),
);
$form['autocomplete']['maxlength'] = array(
'#type' => 'textfield',
'#title' => t('Maximum length of autocomplete'),
'#default_value' => isset($widget['maxlength']) && is_numeric($widget['maxlength']) ? $widget['maxlength'] : 255,
'#element_validate' => array(
'_content_taxonomy_autocomplete_widget_settings_maxlength_validate',
),
'#required' => TRUE,
'#description' => t('Defines how many characters can be typed into the autocomplete field. For values higher than 255, remember that one term name can not be longer than 255 (would be cutted), nevertheless it\'s not a problem for multiple values, separated by commas.'),
);
if (module_exists('active_tags')) {
$form['autocomplete']['active_tags'] = array(
'#type' => 'checkbox',
'#title' => t('Use Active Tags style widget'),
'#default_value' => isset($widget['active_tags']) ? $widget['active_tags'] : 0,
'#description' => t('Use the Active Tags module to improve the usability of this autocomplete widget.'),
);
}
return $form;
case 'save':
return array(
'new_terms',
'extra_parent',
'maxlength',
'active_tags',
);
}
}