You are here

public function EventListBuilder::buildRow in Booking and Availability Management Tools for Drupal 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

modules/bat_event/src/EventListBuilder.php, line 93
Contains \Drupal\bat_event\EventListBuilder.

Class

EventListBuilder
Defines a class to build a listing of Event entities.

Namespace

Drupal\bat_event

Code

public function buildRow(EntityInterface $entity) {
  $date_format = $this->configFactory
    ->get('bat.settings')
    ->get('bat_date_format') ?: 'Y-m-d H:i';
  $row['id'] = $entity
    ->id();
  $row['start_date'] = $entity
    ->getStartDate()
    ->format($date_format);
  $row['end_date'] = $entity
    ->getEndDate()
    ->format($date_format);
  $row['type'] = bat_event_type_load($entity
    ->bundle())
    ->label();
  return $row + parent::buildRow($entity);
}