I found that array_merge is not always a safe way to add submit handlers, (if the index matches - it will replace one with the other, rather than keeping them both) I add submit handlers as follows:

  if ($form_id == 'search_form' || $form_id == 'search_theme_form') {
    $form['#submit']['top_searches_catch_search_keys'] = array();
  }

not sure if this change is necessary... just a suggestion

Comments

z.stolar’s picture

That's true - array_merge will replace values of existing associative keys, but so will your above suggestion :-)

jenlampton’s picture

Ah yes, but my above solution will only replace arguments passed to function 'top_searches_catch_search_keys' - it won't mess with anything else in the submit array.
Jen