You are here

function apachesolr_autocomplete_form_apachesolr_settings_alter in Apache Solr Autocomplete 7

Same name and namespace in other branches
  1. 6 apachesolr_autocomplete.module \apachesolr_autocomplete_form_apachesolr_settings_alter()
  2. 7.2 apachesolr_autocomplete.module \apachesolr_autocomplete_form_apachesolr_settings_alter()

Alter the apachesolr.module "advanced settings" form.

File

./apachesolr_autocomplete.module, line 654
Alters search forms to suggest terms using Apache Solr using AJAX. Thanks to: robertDouglass who contributed some of the code. sch4lly for contributing to D7 version

Code

function apachesolr_autocomplete_form_apachesolr_settings_alter(&$form, $form_state) {
  $form['advanced']['apachesolr_autocomplete_widget'] = array(
    '#type' => 'radios',
    '#title' => t('Autocomplete widget to use'),
    '#description' => t('The custom widget provides instant search upon selection, whereas the Drupal widget needs the user to hit Enter or click on the Search button. If you are having problems, try switching to the default Drupal autocomplete widget.'),
    '#options' => array(
      'jqueryui' => t('jQuery UI Autocomplete'),
      'custom' => t('Custom autocomplete widget'),
      'drupal' => t('Drupal core autocomplete widget'),
    ),
    '#default_value' => apachesolr_autocomplete_variable_get_widget(),
  );
  $form['advanced']['apachesolr_autocomplete_suggest_keywords'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable additional keyword suggestions on the autocomplete widget'),
    '#description' => t('Suggest words to add to the currently typed-in words. E.g.: typing "blue" might suggest "blue bike" or "blue shirt".'),
    '#default_value' => apachesolr_autocomplete_variable_get_suggest_keywords(),
  );
  $form['advanced']['apachesolr_autocomplete_suggest_spellcheck'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable spellchecker suggestions on the autocomplete widget'),
    '#description' => t('Suggest corrections to the currently typed-in words. E.g.: typing "rec" or "redd" might suggest "red".'),
    '#default_value' => apachesolr_autocomplete_variable_get_suggest_spellcheck(),
  );
  $form['advanced']['apachesolr_autocomplete_counts'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable counts in autocomplete widget suggestions'),
    '#description' => t('WARNING: Counts shown alongside suggestions might be lower than the actual result count due to stemming and minimum match (mm) settings in solrconfig.xml.'),
    '#default_value' => apachesolr_autocomplete_variable_get_counts(),
  );
}