You are here

protected function ILTResultViewBuilder::alterBuild in Opigno Instructor-led Trainings 8

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

Specific per-entity building.

Parameters

array $build: The render array that is being created.

\Drupal\Core\Entity\EntityInterface $entity: The entity to be prepared.

\Drupal\Core\Entity\Display\EntityViewDisplayInterface $display: The entity view display holding the display options configured for the entity components.

string $view_mode: The view mode that should be used to prepare the entity.

Overrides EntityViewBuilder::alterBuild

File

src/ILTResultViewBuilder.php, line 17

Class

ILTResultViewBuilder
Provides a list controller for opigno_ilt_result entity.

Namespace

Drupal\opigno_ilt

Code

protected function alterBuild(array &$build, EntityInterface $entity, EntityViewDisplayInterface $display, $view_mode) {

  /** @var \Drupal\opigno_ilt\ILTResultInterface $entity */
  $build[] = [
    '#markup' => $this
      ->t('Instructor-Led Training: @ilt', [
      '@ilt' => $entity
        ->getILT()
        ->toLink(),
    ]),
  ];
  $build[] = [
    '#markup' => $this
      ->t('User: @user', [
      '@user' => $entity
        ->getUser()
        ->toLink(),
    ]),
  ];
  $build[] = [
    '#markup' => $this
      ->t('Status: @status', [
      '@status' => $entity
        ->getStatusString(),
    ]),
  ];
  $build[] = [
    '#markup' => $this
      ->t('Score: @score', [
      '@score' => $entity
        ->getScore(),
    ]),
  ];
}