Version 1
[yaffs-website] / vendor / drupal / console / templates / module / src / cache-context.php.twig
diff --git a/vendor/drupal/console/templates/module/src/cache-context.php.twig b/vendor/drupal/console/templates/module/src/cache-context.php.twig
new file mode 100644 (file)
index 0000000..09c3e4b
--- /dev/null
@@ -0,0 +1,55 @@
+{% extends "base/class.php.twig" %}
+
+{% block file_path %}
+\Drupal\{{module}}\{{ class }}.
+{% endblock %}
+
+{% block namespace_class %}
+namespace Drupal\{{module}}\CacheContext;
+{% endblock %}
+
+{% block use_class %}
+use Drupal\Core\Cache\Context\CacheContextInterface;
+{% endblock %}
+
+{% block class_declaration %}
+/**
+* Class {{ class }}.
+*
+* @package Drupal\{{module}}
+*/
+class {{ class }} implements CacheContextInterface {% endblock %}
+
+{% block class_construct %}
+
+  /**
+  * Constructor.
+  */
+  public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
+  {{ serviceClassInitialization(services) }}
+  }
+
+{% endblock %}
+
+{% block class_methods %}
+  /**
+  * {@inheritdoc}
+  */
+  static function getLabel() {
+  drupal_set_message('Lable of cache context');
+  }
+
+  /**
+  * {@inheritdoc}
+  */
+  public function getContext() {
+  // Actual logic of context variation will lie here.
+  }
+
+  /**
+  * {@inheritdoc}
+  */
+  public function getCacheableMetadata() {
+  // The buble cache metadata.
+  }
+{% endblock %}