function commerce_payment_method_callback in Commerce Core 7
Returns the specified callback for the given payment method if it exists.
Parameters
$payment_method: The payment method object.
$callback: The callback function to return, one of:
- settings_form
- submit_form
- submit_form_validate
- submit_form_submit
- redirect_form
- redirect_form_back
- redirect_form_validate
- redirect_form_submit
Return value
A string containing the name of the callback function or FALSE if it could not be found.
8 calls to commerce_payment_method_callback()
- commerce_payment_order_transaction_add_form in modules/
payment/ includes/ commerce_payment.forms.inc - Allows an administrator to choose a payment method type and add a transaction for a specific order.
- commerce_payment_order_transaction_add_form_submit in modules/
payment/ includes/ commerce_payment.forms.inc - Submit callback for commerce_payment_order_transaction_add_form().
- commerce_payment_order_transaction_add_form_validate in modules/
payment/ includes/ commerce_payment.forms.inc - Validation callback for commerce_payment_order_transaction_add_form().
- commerce_payment_pane_checkout_form in modules/
payment/ includes/ commerce_payment.checkout_pane.inc - Payment pane: form callback.
- commerce_payment_pane_checkout_form_submit in modules/
payment/ includes/ commerce_payment.checkout_pane.inc - Payment pane: submit callback.
File
- modules/
payment/ commerce_payment.module, line 680 - Defines the payment system and checkout integration.
Code
function commerce_payment_method_callback($payment_method, $callback) {
// Include the payment method file if specified.
if (!empty($payment_method['file'])) {
$parts = explode('.', $payment_method['file']);
module_load_include(array_pop($parts), $payment_method['module'], implode('.', $parts));
}
// If the specified callback function exists, return it.
if (!empty($payment_method['callbacks'][$callback]) && is_callable($payment_method['callbacks'][$callback])) {
return $payment_method['callbacks'][$callback];
}
// Otherwise return FALSE.
return FALSE;
}