Yaffs site version 1.1
[yaffs-website] / vendor / drupal / console / templates / module / src / cache-context.php.twig
index 09c3e4b9f3bc9a7d2f64bd96ac03c5f42dc840cf..5445fb3bf7be4c139693048d414a6111c13f2ca7 100644 (file)
@@ -9,6 +9,7 @@ namespace Drupal\{{module}}\CacheContext;
 {% endblock %}
 
 {% block use_class %}
 {% endblock %}
 
 {% block use_class %}
+use Drupal\Core\Cache\CacheableMetadata;
 use Drupal\Core\Cache\Context\CacheContextInterface;
 {% endblock %}
 
 use Drupal\Core\Cache\Context\CacheContextInterface;
 {% endblock %}
 
@@ -23,8 +24,8 @@ class {{ class }} implements CacheContextInterface {% endblock %}
 {% block class_construct %}
 
   /**
 {% block class_construct %}
 
   /**
-  * Constructor.
-  */
+   * Constructs a new {{ class }} object.
+   */
   public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
   {{ serviceClassInitialization(services) }}
   }
   public function __construct({{ servicesAsParameters(services)|join(', ') }}) {
   {{ serviceClassInitialization(services) }}
   }
@@ -35,21 +36,21 @@ class {{ class }} implements CacheContextInterface {% endblock %}
   /**
   * {@inheritdoc}
   */
   /**
   * {@inheritdoc}
   */
-  static function getLabel() {
-  drupal_set_message('Lable of cache context');
+  public static function getLabel() {
+    drupal_set_message('Lable of cache context');
   }
 
   /**
   * {@inheritdoc}
   */
   public function getContext() {
   }
 
   /**
   * {@inheritdoc}
   */
   public function getContext() {
-  // Actual logic of context variation will lie here.
+    // Actual logic of context variation will lie here.
   }
 
   /**
   * {@inheritdoc}
   */
   public function getCacheableMetadata() {
   }
 
   /**
   * {@inheritdoc}
   */
   public function getCacheableMetadata() {
-  // The buble cache metadata.
+    return new CacheableMetadata();
   }
 {% endblock %}
   }
 {% endblock %}