You are here

public function PayPalPaymentsStandard::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_paypal/src/Plugin/Ubercart/PaymentMethod/PayPalPaymentsStandard.php, line 40

Class

PayPalPaymentsStandard
Defines the PayPal Payments Standard payment method.

Namespace

Drupal\uc_paypal\Plugin\Ubercart\PaymentMethod

Code

public function getDisplayLabel($label) {
  $build['paypal-mark'] = [
    '#theme' => 'image',
    '#uri' => 'https://www.paypal.com/en_US/i/logo/PayPal_mark_37x23.gif',
    '#alt' => $this
      ->t('PayPal'),
    '#attributes' => [
      'class' => [
        'uc-credit-cctype',
        'uc-credit-cctype-paypal',
      ],
    ],
  ];
  $build['label'] = [
    '#prefix' => ' ',
    '#plain_text' => $this
      ->t('PayPal - pay without sharing your financial information.'),
    '#suffix' => '<br /> ',
  ];
  $build['includes'] = [
    '#plain_text' => $this
      ->t('Includes:') . ' ',
  ];
  $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,
        ],
      ],
    ];
  }
  $build['image']['paypal'] = $build['paypal-mark'];
  return $build;
}