You are here

public function PayPalCheckout::buildLabel in Commerce PayPal 8

Builds a label for the given payment method.

Parameters

\Drupal\commerce_payment\Entity\PaymentMethodInterface $payment_method: The payment method.

Return value

string The label.

Overrides CreditCard::buildLabel

File

src/Plugin/Commerce/PaymentMethodType/PayPalCheckout.php, line 22

Class

PayPalCheckout
Provides the PayPal Checkout payment method type.

Namespace

Drupal\commerce_paypal\Plugin\Commerce\PaymentMethodType

Code

public function buildLabel(PaymentMethodInterface $payment_method) {
  if ($payment_method
    ->hasField('card_type') && !$payment_method
    ->get('card_type')
    ->isEmpty()) {
    return parent::buildLabel($payment_method);
  }
  return $this
    ->t('PayPal');
}