function nodereference_autocomplete_process in Content Construction Kit (CCK) 6
Same name and namespace in other branches
- 6.3 modules/nodereference/nodereference.module \nodereference_autocomplete_process()
- 6.2 modules/nodereference/nodereference.module \nodereference_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 'nodereference_autocomplete_process'
- nodereference_elements in modules/
nodereference/ nodereference.module - Implementation of FAPI hook_elements().
File
- modules/
nodereference/ nodereference.module, line 446 - Defines a field type for referencing one node from another.
Code
function nodereference_autocomplete_process($element, $edit, $form_state, $form) {
// The nodereference autocomplete widget doesn't need to create its own
// element, it can wrap around the text_textfield element and add an autocomplete
// path and some extra processing to it.
// Add a validation step where the value can be unwrapped.
$field_key = $element['#columns'][0];
$element[$field_key] = array(
'#type' => 'text_textfield',
'#default_value' => isset($element['#value']) ? $element['#value'] : '',
'#autocomplete_path' => 'nodereference/autocomplete/' . $element['#field_name'],
'#element_validate' => array(
'nodereference_autocomplete_validate',
),
// The following values were set by the content module and need
// to be passed down to the nested element.
'#field_name' => $element['#field_name'],
'#delta' => $element['#delta'],
'#columns' => $element['#columns'],
'#title' => $element['#title'],
'#required' => $element['#required'],
'#description' => $element['#description'],
);
return $element;
}