You are here

function apachesolr_search_form_search_block_form_alter in Apache Solr Search 6.3

Same name and namespace in other branches
  1. 8 apachesolr_search.module \apachesolr_search_form_search_block_form_alter()
  2. 6 apachesolr_search.module \apachesolr_search_form_search_block_form_alter()
  3. 6.2 apachesolr_search.module \apachesolr_search_form_search_block_form_alter()
  4. 7 apachesolr_search.module \apachesolr_search_form_search_block_form_alter()

Implements hook_form_[form_id]_alter().

1 call to apachesolr_search_form_search_block_form_alter()
apachesolr_search_form_search_theme_form_alter in ./apachesolr_search.module
Implements hook_form_[form_id]_alter().

File

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

Code

function apachesolr_search_form_search_block_form_alter(&$form, &$form_state) {
  $search_pages = apachesolr_search_load_all_search_pages();
  $redirect_to = variable_get('apachesolr_search_default_search_page', 'drupal_core');
  if ($redirect_to == 'drupal_core') {
    return;
  }
  if (!empty($search_pages[$redirect_to])) {
    $form['#action'] = url($search_pages[$redirect_to]['search_path']);
    if (!isset($form['#submit'])) {
      $form['#submit'] = array(
        'apachesolr_search_search_box_form_submit',
      );
    }
    else {
      $key = array_search('search_box_form_submit', $form['#submit']);
      if ($key !== FALSE) {

        // Replace the search module's function.
        $form['#submit'][$key] = 'apachesolr_search_search_box_form_submit';
      }
    }
  }
}