Networking\InitCmsBundle\EventListener\LocaleListener::onSecurityInteractiveLogin PHP Метод

onSecurityInteractiveLogin() публичный Метод

public onSecurityInteractiveLogin ( Symfony\Component\Security\Http\Event\InteractiveLoginEvent $event )
$event Symfony\Component\Security\Http\Event\InteractiveLoginEvent
    public function onSecurityInteractiveLogin(InteractiveLoginEvent $event)
    {
        $request = $event->getRequest();
        if (!($locale = $event->getAuthenticationToken()->getUser()->getLocale())) {
            $locale = $this->defaultLocale;
        }
        $patterns = $this->accessMap->getPatterns($request);
        //Set backend language to exactly user language settings (if it exists or not)
        $request->getSession()->set('admin/_locale', $locale);
        // If user language does not exist in frontend website, get next best
        $frontendLocale = $this->guessFrontendLocale($locale);
        if (in_array('ROLE_ADMIN', $patterns[0])) {
            $request->setLocale($locale);
        } else {
            $request->setLocale($frontendLocale);
        }
    }