Advertisement
Guest User

Untitled

a guest
Dec 10th, 2013
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.50 KB | None | 0 0
  1. /**
  2.  * Implements hook_form_FORM_ID_alter().
  3.  */
  4. function commerce_paypal_wps_form_commerce_checkout_form_alter(&$form, &$form_state) {
  5.   // If this checkout form contains the payment method radios...
  6.   if (!empty($form['commerce_payment']['payment_method']['#options'])) {
  7.     // Loop over its options array looking for a PayPal WPS option.
  8.     foreach ($form['commerce_payment']['payment_method']['#options'] as $key => &$value) {
  9.       list($method_id, $rule_name) = explode('|', $key);
  10.  
  11.       // If we find PayPal WPS...
  12.       if ($method_id == 'paypal_wps') {
  13.  
  14.       unset($form['commerce_payment']['payment_methods']['#value']['paypal_wps|commerce_payment_paypal_wps']);
  15.       unset($form['commerce_payment']['payment_method']['#options']['paypal_wps|commerce_payment_paypal_wps']);
  16.       $form['commerce_payment']['payment_method']['#default_value'] = "paypal_wps|rules_paypal";
  17.  
  18. //        // Prepare the replacement radio button text with icons.
  19. //        $icons = commerce_paypal_icons();
  20. //        $value = t('!logo PayPal - pay securely without sharing your financial information', array('!logo' => $icons['paypal']));
  21. //        $value .= '<div class="commerce-paypal-icons"><span class="label">' . t('Includes:') . '</span>' . implode(' ', $icons) . '</div>';
  22. //
  23. //        // Add the CSS.
  24. //        $form['commerce_payment']['payment_method']['#attached']['css'][] = drupal_get_path('module', 'commerce_paypal_wps') . '/theme/commerce_paypal_wps.theme.css';
  25. //
  26. //        break;
  27.       }
  28.     }
  29.   }
  30. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement