public function PaymentListBuilder::buildRow in Payment 8.2
{@inheritdnoc}
Overrides EntityListBuilder::buildRow
File
- src/
Entity/ Payment/ PaymentListBuilder.php, line 150
Class
- PaymentListBuilder
- Lists payment entities.
Namespace
Drupal\payment\Entity\PaymentCode
public function buildRow(EntityInterface $payment) {
/** @var \Drupal\payment\Entity\PaymentInterface $payment */
$row['data']['updated'] = $this->dateFormatter
->format($payment
->getChangedTime());
$status_definition = $payment
->getPaymentStatus()
->getPluginDefinition();
$row['data']['status'] = $status_definition['label'];
/** @var \Drupal\currency\Entity\CurrencyInterface $currency */
$currency = $this->currencyStorage
->load($payment
->getCurrencyCode());
if (!$currency) {
$currency = $this->currencyStorage
->load('XXX');
}
$row['data']['amount'] = $currency
->formatAmount($payment
->getAmount());
$row['data']['payment_method'] = $payment
->getPaymentMethod() ? $payment
->getPaymentMethod()
->getPluginDefinition()['label'] : $this
->t('Unavailable');
$row['data']['owner']['data'] = array(
'#theme' => 'username',
'#account' => $payment
->getOwner(),
);
$operations = $this
->buildOperations($payment);
$row['data']['operations']['data'] = $operations;
return $row;
}