Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / vendor / chi-teck / drupal-code-generator / templates / d8 / service / response-policy.twig
diff --git a/vendor/chi-teck/drupal-code-generator/templates/d8/service/response-policy.twig b/vendor/chi-teck/drupal-code-generator/templates/d8/service/response-policy.twig
new file mode 100644 (file)
index 0000000..2dd7672
--- /dev/null
@@ -0,0 +1,23 @@
+<?php
+
+namespace Drupal\{{ machine_name }}\PageCache;
+
+use Drupal\Core\PageCache\ResponsePolicyInterface;
+use Symfony\Component\HttpFoundation\Request;
+use Symfony\Component\HttpFoundation\Response;
+
+/**
+ * A policy disallowing caching requests with certain cookies.
+ */
+class {{ class }} implements ResponsePolicyInterface {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function check(Response $response, Request $request) {
+    if ($request->cookies->get('foo')) {
+      return self::DENY;
+    }
+  }
+
+}