Contao\BackendMain::run PHP Метод

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

Run the controller and parse the login template
public run ( ) : Response
Результат Symfony\Component\HttpFoundation\Response
    public function run()
    {
        $packages = System::getContainer()->getParameter('kernel.packages');
        $this->Template = new \BackendTemplate('be_main');
        $this->Template->version = $packages['contao/core-bundle'];
        $this->Template->main = '';
        // Ajax request
        if ($_POST && \Environment::get('isAjaxRequest')) {
            $this->objAjax = new \Ajax(\Input::post('action'));
            $this->objAjax->executePreActions();
        }
        // Error
        if (\Input::get('act') == 'error') {
            $this->Template->error = $GLOBALS['TL_LANG']['ERR']['general'];
            $this->Template->title = $GLOBALS['TL_LANG']['ERR']['general'];
            @trigger_error('Using act=error has been deprecated and will no longer work in Contao 5.0. Throw an exception instead.', E_USER_DEPRECATED);
        } elseif (!\Input::get('do') && !\Input::get('act')) {
            $this->Template->main .= $this->welcomeScreen();
            $this->Template->title = $GLOBALS['TL_LANG']['MSC']['home'];
        } elseif (\Input::get('do')) {
            $this->Template->main .= $this->getBackendModule(\Input::get('do'));
            $this->Template->title = $this->Template->headline;
        }
        return $this->output();
    }

Usage Example

Пример #1
0
 /**
  * Runs the main back end controller.
  *
  * @return Response
  *
  * @Route("", name="contao_backend")
  */
 public function mainAction()
 {
     $this->container->get('contao.framework')->initialize();
     $controller = new BackendMain();
     return $controller->run();
 }