You are here

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

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

Set the context Learning Path Content ID.

This method will refresh the local actions as well.

Parameters

int $current_content_id: Content ID.

Throws

\Drupal\Core\TempStore\TempStoreException

File

src/OpignoGroupContext.php, line 111

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 setCurrentContentId($current_content_id) {
  static::ensureSession();

  /** @var \Drupal\Core\TempStore\PrivateTempStore $store */
  $store = \Drupal::service('user.private_tempstore')
    ->get('opigno_group_manager');
  if ($store
    ->get(self::CURRENT_CONTENT_ID) != $current_content_id) {
    $store
      ->set(self::CURRENT_CONTENT_ID, $current_content_id);
    self::rebuildActions();
  }
}