/** * {@inheritdoc} */ public function vote(LocaleContextInterface $context) { $request = $context->getRequest(); if (!$request) { throw new \Exception(sprintf('Voter "%s" needs Request on context', __CLASS__)); } return $request->getPreferredLanguage($this->supportedLocales); }
/** * {@inheritdoc} */ public function vote(LocaleContextInterface $context) { $request = $context->getRequest(); if (!$request) { throw new \Exception(sprintf('Voter "%s" needs Request on context', __CLASS__)); } $locale = $request->get('_locale'); if ($locale && $this->suggestLocale($locale)) { return $locale; } }