Early Bird Registration for DrupalCon Portland 2024 is open! Register by 23:59 PST on 31 March 2024, to get $100 off your ticket.
I ran into this because I needed to override the submit handler of a custom search form, but found that I couldn't. Although I was being nice and simply hooking in my own submit handler to override custom_search's submit handler I found that I was being trumped by yet another submit handler. that's because of this code block in custom_search_form_alter
<?php
// Form attributes
$form['#attributes']['class'] = array('search-form');
$form['#submit'][] = 'custom_search_submit';
It could be this and then it will only have the submit handler registered once:
// Form attributes
$form['#attributes']['class'] = array('search-form');
if (!in_array('custom_search_submit', $form['#submit'])) {
$form['#submit'][] = 'custom_search_submit';
}
Comment | File | Size | Author |
---|---|---|---|
#1 | 1909050_2.patch | 694 bytes | cosmicdreams |
Comments
Comment #1
cosmicdreams CreditAttribution: cosmicdreams commentedHere's the patch.
Comment #2
cosmicdreams CreditAttribution: cosmicdreams commentedComment #3
jdanthinne CreditAttribution: jdanthinne commentedSeems ok for me. Pushed to DEV.
Thanks!