You are here

function commerce_paypal_icons in Commerce PayPal 7.2

Same name and namespace in other branches
  1. 7 commerce_paypal.module \commerce_paypal_icons()

Returns an array of PayPal payment method icon img elements.

Parameters

$methods: An array of PayPal payment method names to include in the icons array; if empty, all icons will be returned.

Return value

The array of themed payment method icons keyed by name: visa, mastercard, amex, discover, echeck, paypal, dinersclub, unionpay, jcb

2 calls to commerce_paypal_icons()
commerce_payflow_form_alter in modules/payflow/commerce_payflow.module
Implements hook_form_alter().
commerce_paypal_wps_form_commerce_checkout_form_alter in modules/wps/commerce_paypal_wps.module
Implements hook_form_FORM_ID_alter().

File

./commerce_paypal.module, line 653
Implements PayPal payment services for use with Drupal Commerce.

Code

function commerce_paypal_icons($methods = array()) {
  $icons = array();
  foreach (commerce_paypal_payment_methods() as $name => $title) {
    if (empty($methods) || in_array($name, $methods, TRUE)) {
      $variables = array(
        'path' => drupal_get_path('module', 'commerce_paypal') . '/images/' . $name . '.gif',
        'title' => $title,
        'alt' => $title,
        'attributes' => array(
          'class' => array(
            'commerce-paypal-icon',
          ),
        ),
      );
      $icons[$name] = theme('image', $variables);
    }
  }
  return $icons;
}