You are here

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

Same name and namespace in other branches
  1. 3.x src/ILTResultListBuilder.php \Drupal\opigno_ilt\ILTResultListBuilder::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/ILTResultListBuilder.php, line 28

Class

ILTResultListBuilder
Provides a list controller for opigno_ilt_result entity.

Namespace

Drupal\opigno_ilt

Code

public function buildRow(EntityInterface $entity) {
  if ($user = $entity
    ->getUser()) {

    /* @var \Drupal\opigno_ilt\ILTResultInterface $entity */
    $row['id'] = $entity
      ->id();
    $row['ilt'] = $entity
      ->getILT()
      ->toLink();
    $row['user'] = $user
      ->toLink();
    $row['status'] = $entity
      ->getStatusString();
    $row['score'] = $entity
      ->getScore();
    return $row + parent::buildRow($entity);
  }
}