function commerce_sermepa_form_commerce_checkout_form_alter in Commerce sermepa 7
Implements hook_form_FORM_ID_alter().
File
- ./
commerce_sermepa.module, line 648 - Provides a payment method for Drupal Commerce using Sermepa/Redsys gateway.
Code
function commerce_sermepa_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 options.
foreach (array_keys($form['commerce_payment']['payment_method']['#options']) as $key) {
list($method_id, $rule_name) = explode('|', $key);
// If we find Commerce Sermepa, include its CSS on the form and exit the
// loop.
if ($method_id == 'commerce_sermepa') {
$form['commerce_payment']['payment_method']['#attached']['css'][] = drupal_get_path('module', 'commerce_sermepa') . '/theme/commerce_sermepa.theme.css';
break;
}
}
}
}