Skip to content
Snippets Groups Projects

fixed

1 file
+ 15
15
Compare changes
  • Side-by-side
  • Inline
@@ -42,23 +42,23 @@ class DeviceGeolocationController extends ControllerBase {
@@ -42,23 +42,23 @@ class DeviceGeolocationController extends ControllerBase {
}
}
}
}
if (!empty($data)) {
if (!empty($data)) {
/** @var \Drupal\smart_ip\GetLocationEvent $event */
$event_dispatcher = \Drupal::service('event_dispatcher');
$event = \Drupal::service('smart_ip.get_location_event');
$event = new \Drupal\smart_ip\GetLocationEvent();
$location = $event->getLocation();
$location = $event->getLocation();
$ipAddress = $location->get('ipAddress');
$ipAddress = $location->get('ipAddress');
$ipVersion = $location->get('ipVersion');
$ipVersion = $location->get('ipVersion');
$location->delete()
$location
->setData($data)
->delete()
->set('originalData', $data)
->setData($data)
->set('ipAddress', $ipAddress)
->set('originalData', $data)
->set('ipVersion', $ipVersion)
->set('ipAddress', $ipAddress)
->set('timestamp', \Drupal::time()->getRequestTime());
->set('ipVersion', $ipVersion)
// Allow other modules to modify the acquired location from client
->set('timestamp', \Drupal::time()->getRequestTime());
// side via Symfony Event Dispatcher.
\Drupal::service('event_dispatcher')
$event_dispatcher->dispatch(SmartIpEvents::DATA_ACQUIRED, $event);
->dispatch(SmartIpEvents::DATA_ACQUIRED, $event);
$location->save();
$location->save();
}
}
}
}
}
}
return new JsonResponse();
return new JsonResponse();
Loading