3 namespace Drupal\eu_cookie_compliance\Controller;
5 use Drupal\Core\Controller\ControllerBase;
6 use Symfony\Component\HttpFoundation\JsonResponse;
9 * Controller for JS call that checks if the visitor is in the EU.
11 class CheckIfEuCountryJsController extends ControllerBase {
16 public function content() {
17 $data = eu_cookie_compliance_user_in_eu();
19 // Allow other modules to alter the geo IP matching logic.
20 \Drupal::moduleHandler()->alter('eu_cookie_compliance_geoip_match', $data);
22 return new JsonResponse($data, 200, ['Cache-Control' => 'private']);