You are here

public function SubscriptionListBuilder::buildRow in Commerce Recurring Framework 8

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/SubscriptionListBuilder.php, line 50

Class

SubscriptionListBuilder
List builder for subscriptions.

Namespace

Drupal\commerce_recurring

Code

public function buildRow(EntityInterface $entity) {

  /** @var \Drupal\commerce_recurring\Entity\SubscriptionInterface $entity */
  $row = [
    'id' => $entity
      ->id(),
    'title' => $entity
      ->getTitle(),
    'type' => $entity
      ->getType()
      ->getLabel(),
    'billing_schedule' => $entity
      ->getBillingSchedule()
      ->label(),
    'customer' => $entity
      ->getCustomer()
      ->getDisplayName(),
    'state' => $entity
      ->getState()
      ->getLabel(),
    'start_date' => $entity
      ->getStartDate()
      ->format('M jS Y H:i:s'),
    'end_date' => $entity
      ->getEndDate() ? $entity
      ->getEndDate()
      ->format('M jS Y H:i:s') : '-',
  ];
  return $row + parent::buildRow($entity);
}