09c3e4b9f3bc9a7d2f64bd96ac03c5f42dc840cf
[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\Context\CacheContextInterface;
13 {% endblock %}
14
15 {% block class_declaration %}
16 /**
17 * Class {{ class }}.
18 *
19 * @package Drupal\{{module}}
20 */
21 class {{ class }} implements CacheContextInterface {% endblock %}
22
23 {% block class_construct %}
24
25   /**
26   * Constructor.
27   */
28   public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
29   {{ serviceClassInitialization(services) }}
30   }
31
32 {% endblock %}
33
34 {% block class_methods %}
35   /**
36   * {@inheritdoc}
37   */
38   static function getLabel() {
39   drupal_set_message('Lable of cache context');
40   }
41
42   /**
43   * {@inheritdoc}
44   */
45   public function getContext() {
46   // Actual logic of context variation will lie here.
47   }
48
49   /**
50   * {@inheritdoc}
51   */
52   public function getCacheableMetadata() {
53   // The buble cache metadata.
54   }
55 {% endblock %}