function content_taxonomy_autocomplete_process in Content Taxonomy 6
Same name and namespace in other branches
- 6.2 content_taxonomy_autocomplete.module \content_taxonomy_autocomplete_process()
Process an individual element.
Build the form element. When creating a form using FAPI #process, note that $element['#value'] is already set.
1 string reference to 'content_taxonomy_autocomplete_process'
- content_taxonomy_autocomplete_elements in ./
content_taxonomy_autocomplete.module - Implementation of FAPI hook_elements().
File
- ./
content_taxonomy_autocomplete.module, line 171 - Defines a widget type for content_taxonomy with autocomplete
Code
function content_taxonomy_autocomplete_process($element, $edit, $form_state, $form) {
$field_name = $element['#field_name'];
$field = $form['#field_info'][$field_name];
$field_key = $element['#columns'][0];
$element[$field_key] = array(
'#type' => 'textfield',
'#default_value' => isset($element['#value'][$field_key]) ? $element['#value'][$field_key] : '',
'#autocomplete_path' => 'content_taxonomy/autocomplete/' . $element['#field_name'],
'#title' => $element['#title'],
'#required' => $element['#required'],
'#description' => $element['#description'],
'#field_name' => $element['#field_name'],
'#type_name' => $element['#type_name'],
'#delta' => $element['#delta'],
'#columns' => $element['#columns'],
'#maxlength' => !empty($field['widget']['maxlength']) ? $field['widget']['maxlength'] : 255,
);
if (empty($element[$field_key]['#element_validate'])) {
$element[$field_key]['#element_validate'] = array();
}
array_unshift($element[$field_key]['#element_validate'], 'content_taxonomy_autocomplete_validate');
if (module_exists('active_tags') && $field['widget']['active_tags']) {
active_tags_enable_widget('#' . $element['#id'] . '-value-wrapper');
}
return $element;
}