You are here

function apachesolr_search_form_apachesolr_settings_alter in Apache Solr Search 6

Same name and namespace in other branches
  1. 6.2 apachesolr_search.module \apachesolr_search_form_apachesolr_settings_alter()

Implementation of hook_form_[form_id]_alter().

This adds options to the apachesolr admin form.

File

./apachesolr_search.module, line 1013
Provides a content search implementation for node content for use with the Apache Solr search application.

Code

function apachesolr_search_form_apachesolr_settings_alter(&$form, $form_state) {
  $form['advanced']['apachesolr_search_make_default'] = array(
    '#type' => 'radios',
    '#title' => t('Make Apache Solr Search the default'),
    '#default_value' => variable_get('apachesolr_search_make_default', 0),
    '#options' => array(
      0 => t('Disabled'),
      1 => t('Enabled'),
    ),
    '#description' => t('Hides core node search, and makes the search block submit to Apache Solr Search'),
  );
  $form['advanced']['apachesolr_search_default_previous'] = array(
    '#type' => 'value',
    '#value' => variable_get('apachesolr_search_make_default', 0),
  );
  $form['advanced']['apachesolr_search_taxonomy_links'] = array(
    '#type' => 'radios',
    '#title' => t('Use Apache Solr for taxonomy links'),
    '#default_value' => variable_get('apachesolr_search_taxonomy_links', 0),
    '#description' => t('Note: Vocabularies that need this behavior need to be checked off on the <a href="@enabled_filters_url">enabled filters</a> settings page. Note that content types ommitted from the Apache Solr index will not be shown.', array(
      '@enabled_filters_url' => url('admin/settings/apachesolr/enabled-filters'),
    )),
    '#options' => array(
      0 => t('Disabled'),
      1 => t('Enabled'),
    ),
  );
  $form['advanced']['apachesolr_search_taxonomy_previous'] = array(
    '#type' => 'value',
    '#value' => variable_get('apachesolr_search_taxonomy_links', 0),
  );
  $form['apachesolr_search_spellcheck'] = array(
    '#type' => 'checkbox',
    '#title' => t('Enable spellchecker and suggestions'),
    '#default_value' => variable_get('apachesolr_search_spellcheck', FALSE),
    '#description' => t('Enable spellchecker and get word suggestions. Also known as the "Did you mean ... ?" feature.'),
  );
  $form['#submit'][] = 'apachesolr_search_build_spellcheck';
  $form['#submit'][] = 'apachesolr_search_make_default_submit';

  // Move buttons to the bottom.
  $buttons = $form['buttons'];
  unset($form['buttons']);
  $form['buttons'] = $buttons;
}