You are here

function theme_commerce_sagepay_card_logo in Drupal Commerce SagePay Integration 7

Theme function to display a single card logo

Parameters

string $card: Name of a card as per _commerce_sagepay_all_card_names

string $name: Optionally override the name

string $img: Optionally override the img url

string $href: Optional href to link the image too

Return value

string A themed output of card logo.

1 theme call to theme_commerce_sagepay_card_logo()
theme_commerce_sagepay_card_logos in ./commerce_sagepay.module
Theme function determining how card logos are displayed.

File

./commerce_sagepay.module, line 738

Code

function theme_commerce_sagepay_card_logo($variables) {
  $output = '';
  if (!empty($variables['card'])) {
    if (!empty($variables['img'])) {
      $src = $variables['img'];
    }
    else {
      $path = '/' . drupal_get_path('module', 'commerce_sagepay');
      $src = $path . '/img/' . $variables['card'] . '.png';
    }
    $img = '<img src="' . $src . '" />';
    if (!empty($variables['href'])) {
      $output .= l($img, $variables['href'], array(
        'html' => TRUE,
      ));
    }
    else {
      $output .= $img;
    }
  }
  return $output;
}