You are here

protected static function OpignoGroupContext::ensureSession in Opigno group manager 3.x

Same name and namespace in other branches
  1. 8 src/OpignoGroupContext.php \Drupal\opigno_group_manager\OpignoGroupContext::ensureSession()

Start session for anonymous.

8 calls to OpignoGroupContext::ensureSession()
OpignoGroupContext::getActivityLinkType in src/OpignoGroupContext.php
Gets the context activity answer link type.
OpignoGroupContext::getCurrentGroupContentId in src/OpignoGroupContext.php
Get the group current Content ID (cid).
OpignoGroupContext::getCurrentGroupId in src/OpignoGroupContext.php
Get the group ID. Can be empty.
OpignoGroupContext::removeActivityLinkType in src/OpignoGroupContext.php
Removes the context activity answer link type.
OpignoGroupContext::removeContext in src/OpignoGroupContext.php
Remove all the context variables.

... See full list

File

src/OpignoGroupContext.php, line 22

Class

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

Namespace

Drupal\opigno_group_manager

Code

protected static function ensureSession() {
  if (\Drupal::currentUser()
    ->isAnonymous() && !isset($_SESSION['session_started'])) {
    $_SESSION['session_started'] = TRUE;
    \Drupal::service('session_manager')
      ->start();
  }
}