1 {% extends "base/class.php.twig" %}
4 \Drupal\{{module}}\{{ class }}.
7 {% block namespace_class %}
8 namespace Drupal\{{module}}\CacheContext;
12 use Drupal\Core\Cache\CacheableMetadata;
13 use Drupal\Core\Cache\Context\CacheContextInterface;
16 {% block class_declaration %}
20 class {{ class }} implements CacheContextInterface {% endblock %}
22 {% block class_construct %}
25 * Constructs a new {{ class }} object.
27 public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
28 {{ serviceClassInitialization(services) }}
33 {% block class_methods %}
37 public static function getLabel() {
38 drupal_set_message('Lable of cache context');
44 public function getContext() {
45 // Actual logic of context variation will lie here.
51 public function getCacheableMetadata() {
52 return new CacheableMetadata();