You are here

function hook_name_data_sources in Name Field 7

Defines available name field autocomplete sources.

Return value

array An array of autocomplete sources. Each source is an associative array that may contain the following key-value pairs:

  • "name": Required. The label for the autocomplete source.
  • "autocomplete callback": Optional. The function that does the query.
  • "autocomplete arguments": Optional. Additional arguments to pass to the callback function.
  • "list callback": Optional. Returns a full data listing.
  • "list arguments": Optional. Additional arguments to pass to the callback function.
  • "components": Optional. Limit the components are allowed this source.
  • "autonomous": Optional. Determines if this can be run outside of the field API. Defaults to FALSE.

See also

name_field_autocomplete_query()

1 function implements hook_name_data_sources()

Note: this list is generated by pattern matching, so it may include some functions that are not actually implementations of this hook.

name_name_data_sources in ./name.module
Implements hook_name_data_sources().
4 invocations of hook_name_data_sources()
name_autocomplete in ./name.admin.inc
Menu callback for the name autocomplete.
_name_field_instance_settings_form in includes/name.content.inc
Implements hook_field_instance_settings_form().
_name_field_settings_form in includes/name.content.inc
Implements hook_field_settings_form().
_name_field_widget_form in includes/name.content.inc
Implements hook_field_widget_form().

File

./name.api.php, line 27
API documentation for the Name field module.

Code

function hook_name_data_sources() {
  return array(
    'title' => array(
      'name' => t('Title options'),
      'components' => array(
        'title',
      ),
      'autocomplete callback' => 'name_field_autocomplete_query',
      'autocomplete arguments' => array(
        'title',
      ),
      'list callback' => 'name_field_get_options',
      'list arguments' => array(),
    ),
    'data' => array(
      'name' => t('Existing content'),
      'autonomous' => TRUE,
      'autocomplete callback' => 'name_field_data_query',
    ),
  );
}