Download & Extend

change in how submit handler is added

Project:Top Searches
Version:5.x-1.1
Component:Code
Category:task
Priority:normal
Assigned:Unassigned
Status:active

Issue Summary

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

#1

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

#2

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