Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
/**
* Implements hook_commerce_checkout_pane_info_alter().
*/
function ife_commerce_checkout_pane_info_alter(&$panes) {
foreach ((array) $panes as $key => $pane) {
if (!isset($panes[$key]['callbacks'])) {
$panes[$key]['callbacks'] = array(
'checkout_form_validate' => 'ife_form_validator',
);
}
}
}
When the checkout_form_validate callback function is set, the default validation callback function for the checkout pane would no longer be active. Is there a way to fix it?
Comment | File | Size | Author |
---|---|---|---|
#5 | commerce_forms-1894220-5.patch | 1.72 KB | Deciphered |
#4 | ife-wont-work-with-commerce-checkout-form-1894220-4.patch | 3.02 KB | michaelmol |
#3 | 1894220-3.patch | 3.03 KB | b_sharpe |
#1 | 1894220-ife-commerce-validate-callback.patch | 517 bytes | mrfelton |
Comments
Comment #1
mrfelton CreditAttribution: mrfelton commentedThis fixes a glitch that prevents ife running if ANY custom callback is defined on a checkout pane. This needs more work though to also to get it to work when a custom validation handler is defined.
Comment #2
ipwa CreditAttribution: ipwa commentedPatch didn't work for me. The Shipping page form (commerce_checkout_form_checkout) works well for this module but the form that doesn't play well is the sign in form (commerce_checkout_form_authenticate).
Comment #3
b_sharpe CreditAttribution: b_sharpe commentedBoth the original and patch don't make sense with commerce since the callbacks array is optional and can alternatively be defined by the 'base' setting appended with any of the callback names, so essentially it overwrites possibly valid callback functions.
You likely also want the IFE to work for the whole form, not just single panes. Here is a patch for this to work on the form rather than the panes. Probably can be improved as I whipped it up for my own purposes, but you get the point.
Comment #4
michaelmol CreditAttribution: michaelmol commentedI have extended the patch after getting some notices and the previous patch wasn't generated correctly.
Comment #5
Deciphered CreditAttribution: Deciphered commentedRerolled against HEAD and improved. It now reads in the Commerce errors and calls
form_set_error()
on them so less modifications need to be made in IFE, and any form trying to rebuild ($form_state['rebuild']
) will still work.Comment #6
adrien.felipe CreditAttribution: adrien.felipe commentedI have been using #5 for a few months now and it's working fine.
I vote RTBC
Comment #7
ram4nd CreditAttribution: ram4nd as a volunteer commentedComment #10
ipwa CreditAttribution: ipwa commentedgood job guys :)