function viewreference_autocomplete in View reference 7.3
Same name and namespace in other branches
- 6.3 viewreference.module \viewreference_autocomplete()
- 6 viewreference.module \viewreference_autocomplete()
- 6.2 viewreference.module \viewreference_autocomplete()
Menu callback for the autocomplete results.
3 string references to 'viewreference_autocomplete'
- viewreference_field_info in ./
viewreference.module - Implements hook_field_info().
- viewreference_field_widget_form in ./
viewreference.module - Implements hook_field_widget_form().
- viewreference_menu in ./
viewreference.module - Implements hook_menu().
File
- ./
viewreference.module, line 412 - Defines a field type for referencing a view from a node.
Code
function viewreference_autocomplete($bundle_name, $field_name, $string = '') {
// If the request has a '/' in the search text, then the menu system will have
// split it into multiple arguments, recover the intended $string.
$args = func_get_args();
// Shift off the $bundle_name argument.
array_shift($args);
// Shift off the $field_name argument.
array_shift($args);
$string = implode('/', $args);
$field = field_info_field($field_name);
$settings = $field['settings'];
$matches = viewreference_get_views($settings['append_id'], $settings, FALSE, $string, FALSE, TRUE);
drupal_json_output($matches);
}