You are here

function example_autocomplete_config_form in Search API Autocomplete 7

Form callback for configuring autocompletion for searches of the "example" type.

The returned form array will be nested into an outer form, so you should not rely on knowing the array structure (like the elements' parents) and should not set "#tree" to FALSE for any element.

Parameters

SearchApiAutocompleteSearch $search: The search whose config form should be presented.

See also

example_autocomplete_config_form_validate()

example_autocomplete_config_form_submit()

1 string reference to 'example_autocomplete_config_form'
hook_search_api_autocomplete_types in ./search_api_autocomplete.api.php
Inform the module about types of searches for which autocompletion is available.

File

./search_api_autocomplete.api.php, line 343
Hooks provided by the Search API autocomplete module.

Code

function example_autocomplete_config_form(array $form, array &$form_state, SearchApiAutocompleteSearch $search) {
  $form['user_filters'] = array(
    '#type' => 'textarea',
    '#title' => t('Custom filters'),
    '#description' => t('Enter additional filters set on the autocompletion search. ' . 'Write one filter on each line, the field and its value separated by an equals sign (=).'),
    '#default_value' => empty($search->options['custom']['user_filters']) ? '' : $search->options['custom']['user_filters'],
  );
  return $form;
}