You are here

public static function OpignoGroupManagerController::getGuidedNavigation in Opigno group manager 8

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

Get Learning Path guided navigation field.

Parameters

\Drupal\group\Entity\Group $group: Group object.

Return value

bool Training guided navigation flag

2 calls to OpignoGroupManagerController::getGuidedNavigation()
OpignoGroupManagerController::getGuidedNavigationResponse in src/Controller/OpignoGroupManagerController.php
Return Learning Path guided navigation field.
OpignoGroupManagerController::mustBeVisitedMeeting in src/Controller/OpignoGroupManagerController.php
Check if step is required meeting.

File

src/Controller/OpignoGroupManagerController.php, line 962

Class

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

Namespace

Drupal\opigno_group_manager\Controller

Code

public static function getGuidedNavigation(Group $group) {
  if ($group
    ->getGroupType()
    ->id() == 'opigno_course') {

    //      $route = \Drupal::routeMatch();
    //      $route_name = $route->getRouteName();
    $group_id = OpignoGroupContext::getCurrentGroupId();
    if ($group_id) {
      $group = Group::load($group_id);
    }

    //      if (in_array($route_name, [
    //          'entity.group.canonical',
    //          'opigno_learning_path.steps.start',
    //          'opigno_module.take_module',
    //          'opigno_module.group.answer_form',
    //          'opigno_module.module_result',
    //          'opigno_learning_path.steps.next',
    //        ]) &&
    //        (($entity = $route->getParameter('group')) !== NULL)) {
    //        $group = $entity;
    //      }
    //      if ($route_name == 'opigno_module.module_result') {
    //        $group_id = OpignoGroupContext::getCurrentGroupId();
    //        $group = Group::load($group_id);
    //      }
  }
  $guidedNavigation = NULL;
  if (is_object($group) && $group
    ->hasField('field_guided_navigation')) {
    $guidedNavigation = $group
      ->get('field_guided_navigation')->value;
  }
  return $guidedNavigation ? FALSE : TRUE;
}