You are here

public function UnitListBuilder::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_unit/src/UnitListBuilder.php, line 83
Contains \Drupal\bat_unit\UnitListBuilder.

Class

UnitListBuilder
Defines a class to build a listing of Unit entities.

Namespace

Drupal\bat_unit

Code

public function buildRow(EntityInterface $entity) {

  /* @var $entity \Drupal\bat\Entity\Unit */
  $row['id'] = $entity
    ->id();
  $row['name'] = Link::fromTextAndUrl($entity
    ->label(), new Url('entity.bat_unit.edit_form', [
    'bat_unit' => $entity
      ->id(),
  ]));
  $row['bundle'] = bat_unit_bundle_load($entity
    ->bundle())
    ->label();
  $row['status'] = $entity
    ->getStatus() ? t('Published') : t('Unpublished');
  return $row + parent::buildRow($entity);
}