function nodereference_autocomplete in Content Construction Kit (CCK) 6
Same name and namespace in other branches
- 5 nodereference.module \nodereference_autocomplete()
- 6.3 modules/nodereference/nodereference.module \nodereference_autocomplete()
- 6.2 modules/nodereference/nodereference.module \nodereference_autocomplete()
Retrieve a pipe delimited string of autocomplete suggestions
2 string references to 'nodereference_autocomplete'
- nodereference_menu in modules/
nodereference/ nodereference.module - Implementation of hook_menu().
- nodereference_widget in modules/
nodereference/ nodereference.module - Implementation of hook_widget().
File
- modules/
nodereference/ nodereference.module, line 637 - Defines a field type for referencing one node from another.
Code
function nodereference_autocomplete($field_name, $string = '') {
$fields = content_fields();
$field = $fields[$field_name];
$matches = array();
foreach (_nodereference_potential_references($field, TRUE, $string) as $row) {
$matches[$row->node_title . ' [nid:' . $row->nid . ']'] = _nodereference_item($field, $row, TRUE);
}
drupal_json($matches);
}