You are here

function apachesolr_search_form_apachesolr_settings_alter in Apache Solr Search 6.2

Same name and namespace in other branches
  1. 6 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 1288
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['apachesolr_search_browse'] = array(
    '#type' => 'radios',
    '#title' => t('Behavior on empty search'),
    '#options' => array(
      'none' => t("Show search box"),
      'browse' => t("Show search box and enabled filters' blocks under the search box"),
      'blocks' => t("Show search box and enabled filters' blocks in their configured regions"),
      'results' => t("Show search box, enabled filters' blocks in their configured regions and first page of all available results"),
    ),
    '#default_value' => variable_get('apachesolr_search_browse', 'browse'),
    '#description' => t("This is what is shown when the user enters an empty search, or removes all filters from an active search. Remember to enable filters on the !filterslink and assign blocks to regions on the !blocklink", array(
      '!filterslink' => l('enabled filters page', 'admin/settings/apachesolr/enabled-filters'),
      '!blocklink' => l('block settings page', 'admin/build/block'),
    )),
  );
  $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', TRUE),
    '#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;
}