You are here

function top_searches_form_alter in Top Searches 6

Same name and namespace in other branches
  1. 5 top_searches.module \top_searches_form_alter()
  2. 7 top_searches.module \top_searches_form_alter()

File

./top_searches.module, line 64

Code

function top_searches_form_alter(&$form, &$form_state, $form_id) {

  // Don't count admin searches (like admin/user/search)
  if (arg(0) == 'admin') {
    return;
  }

  // Only count node searches
  // TODO: allow different blocks for different types of seraches
  if (isset($form['module']['#value']) && $form['module']['#value'] != 'node') {
    return;
  }

  // We consider forms which have "search_box_form_submit" as '#submit' to be search forms:
  if (in_array($form_id, array(
    'search_form',
    'search_block_form',
    'search_theme_form',
  ))) {
    $form['#submit'][] = 'top_searches_catch_search_keys';
  }
}