function commerce_sermepa_iupay_form_commerce_checkout_form_alter in Commerce sermepa 7
Implements hook_form_FORM_ID_alter().
File
- modules/
commerce_sermepa_iupay/ commerce_sermepa_iupay.module, line 11 - Provides a payment method for Drupal Commerce using iupay gateway.
Code
function commerce_sermepa_iupay_form_commerce_checkout_form_alter(&$form, &$form_state) {
// If this checkout form contains the payment method radios...
if (!empty($form['commerce_payment']['payment_method']['#options'])) {
// Loop over its options array looking for a Commerce Sermepa iupay options.
foreach (array_keys($form['commerce_payment']['payment_method']['#options']) as $key) {
list($method_id, $rule_name) = explode('|', $key);
// If we find Commerce Sermepa iupay, change the display title.
if (strpos($rule_name, 'commerce_payment_sermepa_iupay_payment') !== FALSE) {
$iupay_button = array(
'path' => drupal_get_path('module', 'commerce_sermepa_iupay') . '/images/iupay.png',
'title' => 'iupay',
'alt' => 'iupay',
'attributes' => array(
'class' => array(
'commerce-sermepa-icon',
),
),
);
$logo = theme('image', $iupay_button);
$display_title = t('!logo - pay with iupay', array(
'!logo' => $logo,
));
$form['commerce_payment']['payment_method']['#options'][$key] = $display_title;
}
}
}
}