From: Raphaƫl Gertz Date: Mon, 3 Oct 2022 06:24:27 +0000 (+0200) Subject: Drop facebook event subscriber handling fb_locale parameter X-Git-Tag: 0.3.0~247 X-Git-Url: https://git.rapsys.eu/airbundle/commitdiff_plain/d3921db1ef1ad823350f3f2339c42ff858210ded?hp=05f12e030d9c39d75f29959596dc3035cd4fb661 Drop facebook event subscriber handling fb_locale parameter --- diff --git a/EventSubscriber/FacebookSubscriber.php b/EventSubscriber/FacebookSubscriber.php deleted file mode 100644 index d950a54..0000000 --- a/EventSubscriber/FacebookSubscriber.php +++ /dev/null @@ -1,75 +0,0 @@ -locales = $locales; - - //Set router - $this->router = $router; - } - - /** - * Change locale for request with ?fb_locale=xx - * - * @param RequestEvent The request event - */ - public function onKernelRequest(RequestEvent $event) { - //Retrieve request - $request = $event->getRequest(); - - //Check for facebook locale - if ( - $request->query->has('fb_locale') && - in_array($preferred = $request->query->get('fb_locale'), $this->locales) - ) { - //Set locale - $request->setLocale($preferred); - - //Set default locale - $request->setDefaultLocale($preferred); - - //Get router context - $context = $this->router->getContext(); - - //Set context locale - $context->setParameter('_locale', $preferred); - - //Set back router context - $this->router->setContext($context); - } - } - - /** - * Get subscribed events - * - * @return array The subscribed events - */ - public static function getSubscribedEvents() { - return [ - // must be registered before the default locale listener - KernelEvents::REQUEST => [['onKernelRequest', 10]] - ]; - } -}