You are here

public function CheckIfEuCountryJsController::content in EU Cookie Compliance (GDPR Compliance) 8

Same name and namespace in other branches
  1. 2.0.x src/Controller/CheckIfEuCountryJsController.php \Drupal\eu_cookie_compliance\Controller\CheckIfEuCountryJsController::content()

Check if visitor is in the EU.

Return value

JsonResponse Whether the user is in EU.

File

src/Controller/CheckIfEuCountryJsController.php, line 19

Class

CheckIfEuCountryJsController
Controller for JS call that checks if the visitor is in the EU.

Namespace

Drupal\eu_cookie_compliance\Controller

Code

public function content() {
  $data = eu_cookie_compliance_user_in_eu();

  // Allow other modules to alter the geo IP matching logic.
  \Drupal::moduleHandler()
    ->alter('eu_cookie_compliance_geoip_match', $data);
  return new JsonResponse($data, 200, [
    'Cache-Control' => 'private',
  ]);
}