You are here

public function ILTListBuilder::buildRow in Opigno Instructor-led Trainings 3.x

Same name and namespace in other branches
  1. 8 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);
}