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 * @package Drupal\{{module}}
22 class {{ class }} implements CacheContextInterface {% endblock %}
24 {% block class_construct %}
27 * Constructs a new {{ class }} object.
29 public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
30 {{ serviceClassInitialization(services) }}
35 {% block class_methods %}
39 public static function getLabel() {
40 drupal_set_message('Lable of cache context');
46 public function getContext() {
47 // Actual logic of context variation will lie here.
53 public function getCacheableMetadata() {
54 return new CacheableMetadata();