From 7889659fcbc25a4991ed37f14eb0a91dd079288d Mon Sep 17 00:00:00 2001 From: M Parker Date: Tue, 3 Oct 2017 14:57:03 -0400 Subject: [PATCH] 2913627-2 --- src/Element/PaymentLineItemsDisplay.php | 32 +++++++++++++++++--------------- 1 file changed, 17 insertions(+), 15 deletions(-) diff --git a/src/Element/PaymentLineItemsDisplay.php b/src/Element/PaymentLineItemsDisplay.php index 2374b093..3042dc24 100644 --- a/src/Element/PaymentLineItemsDisplay.php +++ b/src/Element/PaymentLineItemsDisplay.php @@ -126,24 +126,26 @@ class PaymentLineItemsDisplay extends FormElement implements ContainerFactoryPlu /** @var \Drupal\currency\Entity\CurrencyInterface $payment_line_items_currency */ $payment_line_items_currency = $this->currencyStorage->load($payment_line_items->getCurrencyCode()); - $element['table']['payment_total'] = array( - '#attributes' => array( - 'class' => array('payment-amount'), - ), - 'label' => array( + if ($payment_line_items_currency) { + $element['table']['payment_total'] = array( '#attributes' => array( - 'class' => array('payment-amount-label'), - 'colspan' => 3, + 'class' => array('payment-amount'), ), - '#markup' => $this->t('Total amount'), - ), - 'total' => array( - '#attributes' => array( - 'class' => array('payment-amount-total'), + 'label' => array( + '#attributes' => array( + 'class' => array('payment-amount-label'), + 'colspan' => 3, + ), + '#markup' => $this->t('Total amount'), + ), + 'total' => array( + '#attributes' => array( + 'class' => array('payment-amount-total'), + ), + '#markup' => $payment_line_items_currency->formatAmount($payment_line_items->getAmount()), ), - '#markup' => $payment_line_items_currency->formatAmount($payment_line_items->getAmount()), - ), - ); + ); + } return $element; } -- 2.14.1