You are here

function example_search_api_location_form_callback in Search API Location 7.2

Example for a location_input plugin form callback.

Parameters

array $form_state: The form state data.

array $options: The options for this plugin, as entered into this form previously.

Return value

array A form array for configuring this location_input plugin. Upon submitting of the configuration form, the resulting $form_state['values'] will automatically be saved as the $options of this plugin for future invocations.

1 string reference to 'example_search_api_location_form_callback'
hook_search_api_location_location_input in ./search_api_location.api.php
Defines plugins for handling location input.

File

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

Code

function example_search_api_location_form_callback(array &$form_state, array $options) {
  $handlers = array();
  foreach (geocoder_handler_info() as $id => $handler) {
    $handlers[$id] = $handler['title'];
  }
  $form['handler'] = array(
    '#title' => t('Handler'),
    '#type' => 'select',
    '#options' => $handlers,
    '#default_value' => isset($options['handler']) ? $options['handler'] : NULL,
  );
  return $form;
}