You are here

public function PurchaseOrder::buildLabel in Commerce Purchase Order 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 PaymentMethodTypeInterface::buildLabel

File

src/Plugin/Commerce/PaymentMethodType/PurchaseOrder.php, line 24

Class

PurchaseOrder
Provides the Purchase Order payment method type.

Namespace

Drupal\commerce_purchase_order\Plugin\Commerce\PaymentMethodType

Code

public function buildLabel(PaymentMethodInterface $payment_method) {
  $po_number = NULL;
  if ($payment_method
    ->hasField('po_number')) {
    $po_number = $payment_method->po_number->value;
  }
  $placeholders = [
    '@po_number' => $po_number,
  ];
  return $this
    ->t('Purchase Order# @po_number', $placeholders);
}