change in how submit handler is added
jenlampton - October 21, 2008 - 05:37
| Project: | Top Searches |
| Version: | 5.x-1.1 |
| Component: | Code |
| Category: | task |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Jump to:
Description
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

#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