You are here

public function OpignoGroupManagerController::getNextLink in Opigno group manager 3.x

Same name and namespace in other branches
  1. 8 src/Controller/OpignoGroupManagerController.php \Drupal\opigno_group_manager\Controller\OpignoGroupManagerController::getNextLink()

Returns next link.

File

src/Controller/OpignoGroupManagerController.php, line 135

Class

OpignoGroupManagerController
Controller for all the actions of the Opigno group manager app.

Namespace

Drupal\opigno_group_manager\Controller

Code

public function getNextLink(Group $group) {
  $next_link = NULL;
  if ($group instanceof GroupInterface) {
    $current_step = opigno_learning_path_get_current_step();
    $next_step = $current_step < 5 ? $current_step + 1 : NULL;
    $link_text = !$next_step ? $this
      ->t('Publish') : $this
      ->t('Next');
    $next_link = Link::createFromRoute(Markup::create($link_text . '<i class="fi fi-rr-angle-small-right"></i>'), 'opigno_learning_path.content_steps', [
      'group' => $group
        ->id(),
      'current' => $current_step ? $current_step : 0,
    ], [
      'attributes' => [
        'class' => [
          'btn',
          'btn-rounded',
        ],
      ],
    ])
      ->toRenderable();
  }
  return $next_link;
}