EventAnEnrollCacheContext.php in Open Social 10.3.x
Same filename and directory in other branches
- 8.9 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollCacheContext.php
- 8.8 modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollCacheContext.php
- 10.0.x modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollCacheContext.php
- 10.1.x modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollCacheContext.php
- 10.2.x modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollCacheContext.php
Namespace
Drupal\social_event_an_enrollFile
modules/social_features/social_event/modules/social_event_an_enroll/src/EventAnEnrollCacheContext.phpView source
<?php
namespace Drupal\social_event_an_enroll;
use Drupal\Core\Cache\CacheableMetadata;
use Drupal\Core\Cache\Context\CacheContextInterface;
use Drupal\Core\Routing\RouteMatchInterface;
/**
* Defines a class for a anonymous event enrollment route context.
*/
class EventAnEnrollCacheContext implements CacheContextInterface {
/**
* Route match.
*
* @var \Drupal\Core\Routing\RouteMatchInterface
*/
protected $routeMatch;
/**
* Constructs a new PreviewLinkCacheContext.
*
* @param \Drupal\Core\Routing\RouteMatchInterface $routeMatch
* Route match.
*/
public function __construct(RouteMatchInterface $routeMatch) {
$this->routeMatch = $routeMatch;
}
/**
* {@inheritdoc}
*/
public static function getLabel() {
return 'Is AN enrollment route';
}
/**
* {@inheritdoc}
*/
public function getContext() {
return ($route = $this->routeMatch
->getRouteObject()) && $route
->getOption('_event_an_enroll_route') ?: FALSE;
}
/**
* {@inheritdoc}
*/
public function getCacheableMetadata() {
return (new CacheableMetadata())
->addCacheTags([
'routes',
]);
}
}
Classes
Name | Description |
---|---|
EventAnEnrollCacheContext | Defines a class for a anonymous event enrollment route context. |