You are here

public function PaymentGatewayListBuilder::buildRow in Commerce Core 8.2

Builds a row for an entity in the entity listing.

Parameters

\Drupal\Core\Entity\EntityInterface $entity: The entity for this row of the list.

Return value

array A render array structure of fields for this entity.

Overrides DraggableListBuilder::buildRow

See also

\Drupal\Core\Entity\EntityListBuilder::render()

File

modules/payment/src/PaymentGatewayListBuilder.php, line 39

Class

PaymentGatewayListBuilder
Defines the list builder for payment gateways.

Namespace

Drupal\commerce_payment

Code

public function buildRow(EntityInterface $entity) {

  /** @var \Drupal\commerce_payment\Entity\PaymentGatewayInterface $entity */
  $payment_gateway_plugin = $entity
    ->getPlugin();
  $modes = $payment_gateway_plugin
    ->getSupportedModes();
  $mode = $modes ? $modes[$payment_gateway_plugin
    ->getMode()] : $this
    ->t('N/A');
  $status = $entity
    ->status() ? $this
    ->t('Enabled') : $this
    ->t('Disabled');
  $row['label'] = $entity
    ->label();
  $row['id']['#markup'] = $entity
    ->id();

  // $this->weightKey determines whether the table will be rendered as a form.
  if (!empty($this->weightKey)) {
    $row['mode']['#markup'] = $mode;
    $row['status']['#markup'] = $status;
  }
  else {
    $row['mode'] = $mode;
    $row['status'] = $status;
  }
  return $row + parent::buildRow($entity);
}