You are here

class OpignoCurrentCacheContext in Opigno Learning path 3.x

Defines the OpignoCurrentCacheContext service.

Cache context ID: 'opigno_current'.

Hierarchy

Expanded class hierarchy of OpignoCurrentCacheContext

1 string reference to 'OpignoCurrentCacheContext'
opigno_learning_path.services.yml in ./opigno_learning_path.services.yml
opigno_learning_path.services.yml
1 service uses OpignoCurrentCacheContext
cache_context.opigno_current in ./opigno_learning_path.services.yml
Drupal\opigno_learning_path\Cache\Context\OpignoCurrentCacheContext

File

src/Cache/Context/OpignoCurrentCacheContext.php, line 15

Namespace

Drupal\opigno_learning_path\Cache\Context
View source
class OpignoCurrentCacheContext extends UserCacheContextBase implements CalculatedCacheContextInterface {
  use LearningPathAchievementTrait;

  /**
   * {@inheritdoc}
   */
  public static function getLabel() {
    return t('Opigno current');
  }

  /**
   * {@inheritdoc}
   */
  public function getContext($parameter = NULL) {
    switch ($parameter) {
      case 'group_id':
        return $this
          ->getCurrentGroupId();
      case 'content_id':
        return $this
          ->getCurrentGroupContentId();
      case 'activity_id':
        return $this
          ->getCurrentActivityId();
    }
    return '';
  }

  /**
   * {@inheritdoc}
   */
  public function getCacheableMetadata($parameter = NULL) {
    return new CacheableMetadata();
  }

}

Members

Namesort descending Modifiers Type Description Overrides
LearningPathAchievementTrait::$entityTypeManager protected property
LearningPathAchievementTrait::$routeMatch protected property
LearningPathAchievementTrait::currentUser public function Gets a current user.
LearningPathAchievementTrait::entityTypeManager protected function Retrieves the entity type manager.
LearningPathAchievementTrait::getActivities public function Gets the activities list by the group and module.
LearningPathAchievementTrait::getActivityStatus public function Gets a statuses of activities.
LearningPathAchievementTrait::getCurrentActivityId protected function Current Opigno Activity Id.
LearningPathAchievementTrait::getCurrentGroupContentId protected function Current Group Content Id.
LearningPathAchievementTrait::getCurrentGroupId protected function Current Group Id.
LearningPathAchievementTrait::getStepsByGroup public function Retrieves the steps by group.
LearningPathAchievementTrait::getTargetAttempt protected function Get last or best user attempt for Module.
LearningPathAchievementTrait::routeMatch protected function Retrieves the currently active route match object.
OpignoCurrentCacheContext::getCacheableMetadata public function Gets the cacheability metadata for the context based on the parameter value. Overrides CalculatedCacheContextInterface::getCacheableMetadata
OpignoCurrentCacheContext::getContext public function Returns the string representation of the cache context. Overrides CalculatedCacheContextInterface::getContext
OpignoCurrentCacheContext::getLabel public static function Returns the label of the cache context. Overrides CalculatedCacheContextInterface::getLabel
UserCacheContextBase::$user protected property The account object.
UserCacheContextBase::__construct public function Constructs a new UserCacheContextBase class. 1