src/Contao/View/Contao2BackendView/Filter/LanguageFilter.php
private function checkLanguageSubmit($environment, $languages)
    {
        $inputProvider = $environment->getInputProvider();

        if ('language_switch' !== $inputProvider->getValue('FORM_SUBMIT')) {
            return;
        }

        // Get/Check the new language.
        if ($inputProvider->hasValue('language')
            && \array_key_exists($inputProvider->getValue('language'), $languages)
        ) {
            $session['ml_support'][$environment->getDataDefinition()->getName()] = $inputProvider->getValue('language');
            $environment->getSessionStorage()->set('dc_general', $session);
        }

        $environment->getEventDispatcher()->dispatch(ContaoEvents::CONTROLLER_RELOAD, new ReloadEvent());
    }
private function checkLanguageSubmit($environment, $languages)
    {
        $inputProvider = $environment->getInputProvider();

        if ('language_switch' !== $inputProvider->getValue('FORM_SUBMIT')) {
            return;
        }

        // Get/Check the new language.
        if ($inputProvider->hasValue('language')
            && \array_key_exists($inputProvider->getValue('language'), $languages)
        ) {
            $session['ml_support'][$environment->getDataDefinition()->getName()] = $inputProvider->getValue('language');
            $environment->getSessionStorage()->set('dc_general', $session);
        }

        $environment->getEventDispatcher()->dispatch(ContaoEvents::CONTROLLER_RELOAD, new ReloadEvent());
    }
private function checkLanguageSubmit ( $ environment , $ languages ) { $ inputProvider = $ environment -> getInputProvider ( ) ; if ( 'language_switch' !== $ inputProvider -> getValue ( 'FORM_SUBMIT' ) ) { return ; } // Get/Check the new language. if ( $ inputProvider -> hasValue ( 'language' ) && \ array_key_exists ( $ inputProvider -> getValue ( 'language' ) , $ languages ) ) { $ session [ 'ml_support' ] [ $ environment -> getDataDefinition ( ) -> getName ( ) ] = $ inputProvider -> getValue ( 'language' ) ; $ environment -> getSessionStorage ( ) -> set ( 'dc_general' , $ session ) ; } $ environment -> getEventDispatcher ( ) -> dispatch ( ContaoEvents :: CONTROLLER_RELOAD , new ReloadEvent ( ) ) ; }
Check if the language has been switched.

If so, the value in the session will be updated and the page reloaded.

@param EnvironmentInterface $environment The environment.
@param array                $languages   The valid languages.

@return void
Check if the language has been switched .