You are here

public function CreditCardPaymentMethodBase::getDisplayLabel in Ubercart 8.4

Returns the payment method label with logo.

Parameters

string $label: The payment method label to be styled.

Return value

array A render array containing the formatted payment method label.

Overrides PaymentMethodPluginBase::getDisplayLabel

File

payment/uc_credit/src/CreditCardPaymentMethodBase.php, line 67

Class

CreditCardPaymentMethodBase
Defines a base credit card payment method plugin implementation.

Namespace

Drupal\uc_credit

Code

public function getDisplayLabel($label) {
  $build['#attached']['library'][] = 'uc_credit/uc_credit.styles';
  $build['label'] = [
    '#plain_text' => $label,
  ];
  $cc_types = $this
    ->getEnabledTypes();
  foreach ($cc_types as $type => $description) {
    $build['image'][$type] = [
      '#theme' => 'image',
      '#uri' => drupal_get_path('module', 'uc_credit') . '/images/' . $type . '.gif',
      '#alt' => $description,
      '#attributes' => [
        'class' => [
          'uc-credit-cctype',
          'uc-credit-cctype-' . $type,
        ],
      ],
    ];
  }
  return $build;
}