You are here

function search_log_form_alter in Search Log 7

Same name and namespace in other branches
  1. 8 search_log.module \search_log_form_alter()
  2. 6 search_log.module \search_log_form_alter()

Implements hook_form_alter().

Alter standard search forms to capture submission.

File

./search_log.module, line 105
Replaces default report of top search phrases.

Code

function search_log_form_alter(&$form, &$form_state, $form_id) {
  $form_id_processed = $form_id;

  // Custom Search module.
  if (strpos($form_id_processed, 'custom_search_blocks_form') !== FALSE) {
    $form_id_processed = 'custom_search_blocks_form';
  }
  if (!isset($form['#submit'])) {
    $form['#submit'] = array();
  }
  switch ($form_id_processed) {
    case 'search_form':
      array_unshift($form['#submit'], 'search_log_search_form_submit');
      break;
    case 'search_block_form':
      array_unshift($form['#submit'], 'search_log_search_block_form_submit');
      break;
    case 'search_theme_form':
      array_unshift($form['#submit'], 'search_log_search_theme_form_submit');
      break;
    case 'custom_search_blocks_form':
      array_unshift($form['#submit'], 'search_log_custom_search_blocks_form_submit');
      break;
  }
}