You are here

function finder_autocomplete_finder_element in Finder 7

Same name and namespace in other branches
  1. 6 modules/finder_autocomplete/finder_autocomplete.module \finder_autocomplete_finder_element()

Implements hook_finder_element().

See also

hook_finder_element()

File

modules/finder_autocomplete/finder_autocomplete.module, line 135
The finder autocomplete module.

Code

function finder_autocomplete_finder_element($element, &$form_element) {
  if ($element->element == 'autocomplete') {
    $form_element['#type'] = 'textfield';
    $autocomplete_path = 'finder_autocomplete/autocomplete/' . $element->finder_id . '/' . $element->finder_element_id;
    if ($element->settings['form']['autosubmit']) {
      $form_element['#theme'] = 'finder_autocomplete_textfield';
    }
    $form_element['#autocomplete_path'] = $autocomplete_path;
    $properties = array(
      'field_prefix',
      'field_suffix',
      'maxlength',
      'size',
    );
    foreach ($properties as $property) {
      if ($element->settings['form'][$property]) {
        $form_element['#' . $property] = $element->settings['form'][$property];
      }
    }
  }
}