diff --git a/modules/wps/commerce_paypal_wps.module b/modules/wps/commerce_paypal_wps.module index 1e6146d..51b5c4e 100644 --- a/modules/wps/commerce_paypal_wps.module +++ b/modules/wps/commerce_paypal_wps.module @@ -5,6 +5,23 @@ * Implements PayPal Website Payments Standard in Drupal Commerce checkout. */ +/** + * Implements hook_form_alter(). + */ +function commerce_paypal_wps_form_alter(&$form, &$form_state, $form_id) { + // If the form is a checkout form. + if (preg_match('/^commerce_checkout_form/', $form_id)) { + // If the checkout form contains the PayPal WPS payment option. + if (!empty($form['commerce_payment']['payment_method']['#options']['paypal_wps|commerce_payment_paypal_wps'])) { + // Theme the paypal icons and add them to the radio button for PayPal WPS. + $icons = commerce_paypal_icons(); + $display_title = t('!logo PayPal - pay securely without sharing your financial information', array('!logo' => $icons['paypal'])); + $display_title .= '
' . t('Includes:') . '' . implode(' ', $icons) . '
'; + $form['commerce_payment']['payment_method']['#options']['paypal_wps|commerce_payment_paypal_wps'] = $display_title; + $form['#attached']['css'][] = drupal_get_path('module', 'commerce_paypal_wps') . '/theme/commerce_paypal_wps.css'; + } + } +} /** * Implements hook_commerce_payment_method_info(). @@ -20,7 +37,7 @@ function commerce_paypal_wps_commerce_payment_method_info() { 'base' => 'commerce_paypal_wps', 'title' => t('PayPal WPS'), 'short_title' => t('PayPal'), - 'display_title' => $display_title, + 'display_title' => t('PayPal Website Payments Standard'), 'description' => t('PayPal Website Payments Standard'), 'terminal' => FALSE, 'offsite' => TRUE,