Contao\BackendIndex::run PHP Method

run() public method

Run the controller and parse the login template
public run ( ) : Response
return Symfony\Component\HttpFoundation\Response
    public function run()
    {
        /** @var BackendTemplate|object $objTemplate */
        $objTemplate = new \BackendTemplate('be_login');
        $strHeadline = sprintf($GLOBALS['TL_LANG']['MSC']['loginTo'], \Config::get('websiteTitle'));
        $objTemplate->theme = \Backend::getTheme();
        $objTemplate->messages = \Message::generate();
        $objTemplate->base = \Environment::get('base');
        $objTemplate->language = $GLOBALS['TL_LANGUAGE'];
        $objTemplate->languages = \System::getLanguages(true);
        $objTemplate->title = \StringUtil::specialchars($strHeadline);
        $objTemplate->charset = \Config::get('characterSet');
        $objTemplate->action = ampersand(\Environment::get('request'));
        $objTemplate->userLanguage = $GLOBALS['TL_LANG']['tl_user']['language'][0];
        $objTemplate->headline = $strHeadline;
        $objTemplate->curLanguage = \Input::post('language') ?: str_replace('-', '_', $GLOBALS['TL_LANGUAGE']);
        $objTemplate->curUsername = \Input::post('username') ?: '';
        $objTemplate->uClass = $_POST && empty($_POST['username']) ? ' class="login_error"' : '';
        $objTemplate->pClass = $_POST && empty($_POST['password']) ? ' class="login_error"' : '';
        $objTemplate->loginButton = \StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['loginBT']);
        $objTemplate->username = $GLOBALS['TL_LANG']['tl_user']['username'][0];
        $objTemplate->password = $GLOBALS['TL_LANG']['MSC']['password'][0];
        $objTemplate->feLink = $GLOBALS['TL_LANG']['MSC']['feLink'];
        $objTemplate->default = $GLOBALS['TL_LANG']['MSC']['default'];
        $objTemplate->jsDisabled = $GLOBALS['TL_LANG']['MSC']['jsDisabled'];
        return $objTemplate->getResponse();
    }

Usage Example

 /**
  * Renders the back end login form.
  *
  * @return Response
  *
  * @Route("/login", name="contao_backend_login")
  */
 public function loginAction()
 {
     $this->container->get('contao.framework')->initialize();
     $controller = new BackendIndex();
     return $controller->run();
 }
BackendIndex