You are here

public function OrderListBuilder::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 EntityListBuilder::buildRow

See also

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

File

modules/order/src/OrderListBuilder.php, line 85

Class

OrderListBuilder
Defines the list builder for orders.

Namespace

Drupal\commerce_order

Code

public function buildRow(EntityInterface $entity) {

  /** @var \Drupal\commerce_order\Entity\OrderInterface $entity  */
  $order_type = OrderType::load($entity
    ->bundle());
  $row = [
    'order_id' => $entity
      ->id(),
    'type' => $order_type
      ->label(),
    'customer' => [
      'data' => [
        '#theme' => 'username',
        '#account' => $entity
          ->getCustomer(),
      ],
    ],
    'state' => $entity
      ->getState()
      ->getLabel(),
    'created' => $this->dateFormatter
      ->format($entity
      ->getCreatedTime(), 'short'),
  ];
  return $row + parent::buildRow($entity);
}