You are here

public function StateListBuilder::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/StateListBuilder.php, line 103
Contains \Drupal\bat_event\StateListBuilder.

Class

StateListBuilder
Provides a listing of State entities.

Namespace

Drupal\bat_event

Code

public function buildRow(EntityInterface $entity) {
  $row['id'] = $entity
    ->id();
  $row['name'] = Link::fromTextAndUrl($entity
    ->label(), new Url('entity.state.edit_form', [
    'state' => $entity
      ->id(),
  ]));
  $row['color'] = $entity
    ->getColor();
  $row['calendar_label'] = $entity
    ->getCalendarLabel();
  $row['blocking'] = $entity
    ->getBlocking() ? t('Blocking') : t('Not blocking');
  $row['event_type'] = ($event_type = $entity
    ->getEventType()) ? $event_type
    ->label() : '';
  return $row + parent::buildRow($entity);
}