Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /**
- * Implements hook_form_FORM_ID_alter().
- */
- function commerce_paypal_wps_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 PayPal WPS option.
- foreach ($form['commerce_payment']['payment_method']['#options'] as $key => &$value) {
- list($method_id, $rule_name) = explode('|', $key);
- // If we find PayPal WPS...
- if ($method_id == 'paypal_wps') {
- unset($form['commerce_payment']['payment_methods']['#value']['paypal_wps|commerce_payment_paypal_wps']);
- unset($form['commerce_payment']['payment_method']['#options']['paypal_wps|commerce_payment_paypal_wps']);
- $form['commerce_payment']['payment_method']['#default_value'] = "paypal_wps|rules_paypal";
- // // Prepare the replacement radio button text with icons.
- // $icons = commerce_paypal_icons();
- // $value = t('!logo PayPal - pay securely without sharing your financial information', array('!logo' => $icons['paypal']));
- // $value .= '<div class="commerce-paypal-icons"><span class="label">' . t('Includes:') . '</span>' . implode(' ', $icons) . '</div>';
- //
- // // Add the CSS.
- // $form['commerce_payment']['payment_method']['#attached']['css'][] = drupal_get_path('module', 'commerce_paypal_wps') . '/theme/commerce_paypal_wps.theme.css';
- //
- // break;
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement