You are here

public function ILTListBuilder::buildRow in Opigno Instructor-led Trainings 8

Same name and namespace in other branches
  1. 3.x src/ILTListBuilder.php \Drupal\opigno_ilt\ILTListBuilder::buildRow()

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/ILTListBuilder.php, line 28

Class

ILTListBuilder
Provides a list controller for opigno_ilt entity.

Namespace

Drupal\opigno_ilt

Code

public function buildRow(EntityInterface $entity) {

  /* @var \Drupal\opigno_ilt\ILTInterface $entity */
  $row['id'] = $entity
    ->id();
  $row['name'] = $entity
    ->toLink();
  $training = $entity
    ->getTraining();
  $row['training'] = isset($training) ? $entity
    ->getTraining()
    ->toLink() : '-';
  $date = $entity
    ->getStartDate();
  $row['date'] = !empty($date) ? $date : '-';
  return $row + parent::buildRow($entity);
}