You are here

protected function ILTViewBuilder::buildNavigation in Opigno Instructor-led Trainings 8

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

Returns render array for the navigation.

Parameters

\Drupal\opigno_ilt\ILTInterface $entity: ILT interface.

Return value

array Render array.

1 call to ILTViewBuilder::buildNavigation()
ILTViewBuilder::alterBuild in src/ILTViewBuilder.php
Specific per-entity building.

File

src/ILTViewBuilder.php, line 25

Class

ILTViewBuilder
Provides a list controller for opigno_ilt entity.

Namespace

Drupal\opigno_ilt

Code

protected function buildNavigation(ILTInterface $entity) {
  $gid = $entity
    ->getTrainingId();
  if (empty($gid)) {
    return [];
  }
  $actions = [];
  $actions['form-actions'] = [
    '#type' => 'container',
    '#attributes' => [
      'class' => [
        'form-actions',
      ],
      'id' => 'edit-actions',
    ],
    '#title' => 'test',
  ];
  $title = $this
    ->t('Back to training homepage');
  $route = 'entity.group.canonical';
  $route_params = [
    'group' => $gid,
  ];
  $options = [
    'attributes' => [
      'class' => [
        'btn',
        'btn-success',
      ],
      'id' => 'edit-submit',
    ],
  ];
  $actions['form-actions'][] = Link::createFromRoute($title, $route, $route_params, $options)
    ->toRenderable();
  return $actions;
}