1 form.inc form_process_autocomplete($element)

Process function to prepare autocomplete data.


$element: A textfield or other element with a #autocomplete_path.

Return value

array: The processed form element.

Related topics


core/includes/form.inc, line 4330
Functions for form and batch generation and processing.


function form_process_autocomplete($element) {
  $element['#autocomplete_input'] = array();
  if ($element['#autocomplete_path'] && backdrop_valid_path($element['#autocomplete_path'])) {
    $element['#autocomplete_input']['#id'] = $element['#id'] . '-autocomplete';
    // Force the script path to 'index.php', in case the server is not
    // configured to find it automatically. Normally it is the responsibility
    // of the site to do this themselves using hook_url_outbound_alter() (see
    // url()) but since this code is forcing non-clean URLs on sites that don't
    // normally use them, it is done here instead.
    $element['#autocomplete_input']['#url_value'] = url($element['#autocomplete_path'], array('absolute' => TRUE, 'clean' => FALSE, 'script' => 'index.php'));
  return $element;