Updated to Drupal 8.5. Core Media not yet in use.
[yaffs-website] / web / modules / contrib / eu_cookie_compliance / src / Controller / CheckIfEuCountryJsController.php
diff --git a/web/modules/contrib/eu_cookie_compliance/src/Controller/CheckIfEuCountryJsController.php b/web/modules/contrib/eu_cookie_compliance/src/Controller/CheckIfEuCountryJsController.php
new file mode 100644 (file)
index 0000000..a27b55a
--- /dev/null
@@ -0,0 +1,21 @@
+<?php
+
+namespace Drupal\eu_cookie_compliance\Controller;
+
+use Drupal\Core\Controller\ControllerBase;
+use Symfony\Component\HttpFoundation\JsonResponse;
+
+/**
+ * Controller for JS call that checks if the visitor is in the EU.
+ */
+class CheckIfEuCountryJsController extends ControllerBase {
+
+  /**
+   * {@inheritdoc}
+   */
+  public function content() {
+    $data = eu_cookie_compliance_user_in_eu();
+    return new JsonResponse($data, 200, ['Cache-Control' => 'private']);
+  }
+
+}