You are here

public function ShipmentListBuilder::buildRow in Commerce Shipping 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

src/ShipmentListBuilder.php, line 108

Class

ShipmentListBuilder
Defines the list builder for shipments.

Namespace

Drupal\commerce_shipping

Code

public function buildRow(EntityInterface $entity) {

  /** @var \Drupal\commerce_shipping\Entity\ShipmentInterface $entity */
  $amount = $entity
    ->getAmount();
  $row['label']['data'] = [
    '#type' => 'link',
    '#title' => $entity
      ->label(),
  ] + $entity
    ->toUrl()
    ->toRenderArray();
  $row['tracking'] = $entity
    ->getTrackingCode();
  $row['amount'] = $this->currencyFormatter
    ->format($amount
    ->getNumber(), $amount
    ->getCurrencyCode());
  $row['state'] = $entity
    ->getState()
    ->getLabel();
  return $row + parent::buildRow($entity);
}