class OpignoCurrentCacheContext in Opigno Learning path 3.x
Defines the OpignoCurrentCacheContext service.
Cache context ID: 'opigno_current'.
Hierarchy
- class \Drupal\Core\Cache\Context\UserCacheContextBase
- class \Drupal\opigno_learning_path\Cache\Context\OpignoCurrentCacheContext implements CalculatedCacheContextInterface uses LearningPathAchievementTrait
Expanded class hierarchy of OpignoCurrentCacheContext
1 string reference to 'OpignoCurrentCacheContext'
1 service uses OpignoCurrentCacheContext
File
- src/
Cache/ Context/ OpignoCurrentCacheContext.php, line 15
Namespace
Drupal\opigno_learning_path\Cache\ContextView 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
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
LearningPathAchievementTrait:: |
protected | property | ||
LearningPathAchievementTrait:: |
protected | property | ||
LearningPathAchievementTrait:: |
public | function | Gets a current user. | |
LearningPathAchievementTrait:: |
protected | function | Retrieves the entity type manager. | |
LearningPathAchievementTrait:: |
public | function | Gets the activities list by the group and module. | |
LearningPathAchievementTrait:: |
public | function | Gets a statuses of activities. | |
LearningPathAchievementTrait:: |
protected | function | Current Opigno Activity Id. | |
LearningPathAchievementTrait:: |
protected | function | Current Group Content Id. | |
LearningPathAchievementTrait:: |
protected | function | Current Group Id. | |
LearningPathAchievementTrait:: |
public | function | Retrieves the steps by group. | |
LearningPathAchievementTrait:: |
protected | function | Get last or best user attempt for Module. | |
LearningPathAchievementTrait:: |
protected | function | Retrieves the currently active route match object. | |
OpignoCurrentCacheContext:: |
public | function |
Gets the cacheability metadata for the context based on the parameter value. Overrides CalculatedCacheContextInterface:: |
|
OpignoCurrentCacheContext:: |
public | function |
Returns the string representation of the cache context. Overrides CalculatedCacheContextInterface:: |
|
OpignoCurrentCacheContext:: |
public static | function |
Returns the label of the cache context. Overrides CalculatedCacheContextInterface:: |
|
UserCacheContextBase:: |
protected | property | The account object. | |
UserCacheContextBase:: |
public | function | Constructs a new UserCacheContextBase class. | 1 |