Security update for Core, with self-updated composer
[yaffs-website] / vendor / drupal / console / templates / module / src / cache-context.php.twig
1 {% extends "base/class.php.twig" %}
2
3 {% block file_path %}
4 \Drupal\{{module}}\{{ class }}.
5 {% endblock %}
6
7 {% block namespace_class %}
8 namespace Drupal\{{module}}\CacheContext;
9 {% endblock %}
10
11 {% block use_class %}
12 use Drupal\Core\Cache\CacheableMetadata;
13 use Drupal\Core\Cache\Context\CacheContextInterface;
14 {% endblock %}
15
16 {% block class_declaration %}
17 /**
18 * Class {{ class }}.
19 */
20 class {{ class }} implements CacheContextInterface {% endblock %}
21
22 {% block class_construct %}
23
24   /**
25    * Constructs a new {{ class }} object.
26    */
27   public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
28   {{ serviceClassInitialization(services) }}
29   }
30
31 {% endblock %}
32
33 {% block class_methods %}
34   /**
35   * {@inheritdoc}
36   */
37   public static function getLabel() {
38     drupal_set_message('Lable of cache context');
39   }
40
41   /**
42   * {@inheritdoc}
43   */
44   public function getContext() {
45     // Actual logic of context variation will lie here.
46   }
47
48   /**
49   * {@inheritdoc}
50   */
51   public function getCacheableMetadata() {
52     return new CacheableMetadata();
53   }
54 {% endblock %}