You are here

public static function OpignoGroupContext::getCurrentGroupId in Opigno group manager 8

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

Get the group ID. Can be empty.

Return value

int The group context NID.

1 call to OpignoGroupContext::getCurrentGroupId()
OpignoGroupManagerController::getGuidedNavigation in src/Controller/OpignoGroupManagerController.php
Get Learning Path guided navigation field.

File

src/OpignoGroupContext.php, line 36

Class

OpignoGroupContext
This class manage the context when a user enters or exits a Learning Path.

Namespace

Drupal\opigno_group_manager

Code

public static function getCurrentGroupId() {
  static::ensureSession();
  $group = \Drupal::routeMatch()
    ->getParameter('group');
  if (!empty($group)) {
    if (is_object($group)) {
      return $group
        ->id();
    }
    else {
      return $group;
    }
  }

  /* @var \Drupal\Core\TempStore\PrivateTempStore $store */
  $store = \Drupal::service('user.private_tempstore')
    ->get('opigno_group_manager');
  return $store
    ->get(self::GROUP_ID);
}