You are here

function hook_search_api_location_location_input in Search API Location 7.2

Defines plugins for handling location input.

This can be used to allow users different methods to enter location data. This module already provides two such plugins: "raw" for raw input of locations as coordinates, and "geocoder" (if the geocoder module is enabled) for location input handled by Geocoder.

This uses CTools' plugin system, so plugins can also be defined via plugin files. For details, see CTools' documentation (if you have advanced_help installed: help/ctools/plugins-implementing), or look at the files in plugins/location_input in this module for examples.

Also see CTools' documentation for other hooks provided for these plugins.

Return value

array An array of location_input plugin definitions. The keys are the plugins' identifiers, the values are arrays with the following keys:

  • title: The human-readable name of the plugin.
  • description: (optional) A human-readable description of how input is handled by this plugin.
  • input callback: Callback to parse user input into a location. For the function documentation of the callback, see example_search_api_location_input_callback() below.
  • form callback: (optional) A callback for showing a configuration form for this plugin to the user. For the function documentation of the callback, see example_search_api_location_form_callback() below.

File

./search_api_location.api.php, line 36
Hooks provided by the Search API location module.

Code

function hook_search_api_location_location_input() {
  $plugins['example'] = array(
    'title' => t('Example location thingie'),
    'description' => t('Determine location by higher magic.'),
    'input callback' => 'example_search_api_location_input_callback',
    'form callback' => 'example_search_api_location_form_callback',
  );
  return $plugins;
}