core-bundle/src/Resources/contao/controllers/BackendMain.php
protected function output()
	{
		// Default headline
		if ($this->Template->headline == '')
		{
			$this->Template->headline = $GLOBALS['TL_LANG']['MSC']['dashboard'];
		}

		// Default title
		if ($this->Template->title == '')
		{
			$this->Template->title = $this->Template->headline;
		}

		$container = System::getContainer();
		$objSession = $container->get('session');

		// File picker reference (backwards compatibility)
		if (Input::get('popup') && Input::get('act') != 'show' && ((Input::get('do') == 'page' && $this->User->hasAccess('page', 'modules')) || (Input::get('do') == 'files' && $this->User->hasAccess('files', 'modules'))) && $objSession->get('filePickerRef'))
		{
			$this->Template->managerHref = ampersand($objSession->get('filePickerRef'));
			$this->Template->manager = (strpos($objSession->get('filePickerRef'), 'contao/page?') !== false) ? $GLOBALS['TL_LANG']['MSC']['pagePickerHome'] : $GLOBALS['TL_LANG']['MSC']['filePickerHome'];
		}

		$referer = null;

		if ($request = $container->get('request_stack')->getCurrentRequest())
		{
			$referer = base64_encode($request->getQueryString());
		}

		$this->Template->theme = Backend::getTheme();
		$this->Template->base = Environment::get('base');
		$this->Template->language = $GLOBALS['TL_LANGUAGE'];
		$this->Template->title = StringUtil::specialchars(strip_tags($this->Template->title));
		$this->Template->host = Environment::get('host');
		$this->Template->charset = Config::get('characterSet');
		$this->Template->account = $GLOBALS['TL_LANG']['MOD']['login'][1];
		$this->Template->preview = $GLOBALS['TL_LANG']['MSC']['fePreview'];
		$this->Template->previewTitle = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['fePreviewTitle']);
		$this->Template->profile = $GLOBALS['TL_LANG']['MSC']['profile'];
		$this->Template->canDebug = $this->User->isAdmin;
		$this->Template->isDebug = $container->get('kernel')->isDebug();
		$this->Template->debug = $container->get('kernel')->isDebug() ? $GLOBALS['TL_LANG']['MSC']['disableDebugMode'] : $GLOBALS['TL_LANG']['MSC']['enableDebugMode'];
		$this->Template->referer = $referer;
		$this->Template->profileTitle = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['profileTitle']);
		$this->Template->security = $GLOBALS['TL_LANG']['MSC']['security'];
		$this->Template->pageOffset = (int) Input::cookie('BE_PAGE_OFFSET');
		$this->Template->logout = $GLOBALS['TL_LANG']['MSC']['logoutBT'];
		$this->Template->logoutLink = System::getContainer()->get('security.logout_url_generator')->getLogoutUrl();
		$this->Template->logoutTitle = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['logoutBTTitle']);
		$this->Template->user = $this->User;
		$this->Template->username = $GLOBALS['TL_LANG']['MSC']['user'] . ' ' . $this->User->getUsername();
		$this->Template->request = ampersand(Environment::get('request'));
		$this->Template->top = $GLOBALS['TL_LANG']['MSC']['backToTop'];
		$this->Template->modules = $this->User->navigation();
		$this->Template->home = $GLOBALS['TL_LANG']['MSC']['home'];
		$this->Template->homeTitle = $GLOBALS['TL_LANG']['MSC']['homeTitle'];
		$this->Template->backToTop = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['backToTopTitle']);
		$this->Template->expandNode = $GLOBALS['TL_LANG']['MSC']['expandNode'];
		$this->Template->collapseNode = $GLOBALS['TL_LANG']['MSC']['collapseNode'];
		$this->Template->loadingData = $GLOBALS['TL_LANG']['MSC']['loadingData'];
		$this->Template->isPopup = Input::get('popup');
		$this->Template->systemMessages = $GLOBALS['TL_LANG']['MSC']['systemMessages'];
		$this->Template->burger = $GLOBALS['TL_LANG']['MSC']['burgerTitle'];
		$this->Template->learnMore = sprintf($GLOBALS['TL_LANG']['MSC']['learnMore'], '<a href="https://contao.org" target="_blank" rel="noreferrer noopener">contao.org</a>');
		$this->Template->ref = $container->get('request_stack')->getCurrentRequest()->attributes->get('_contao_referer_id');
		$this->Template->menu = $container->get('contao.menu.backend_menu_renderer')->render($container->get('contao.menu.backend_menu_builder')->create());
		$this->Template->headerNavigation = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['headerNavigation']);

		$strSystemMessages = Backend::getSystemMessages();
		$this->Template->systemMessagesCount = substr_count($strSystemMessages, 'class="tl_');
		$this->Template->systemErrorMessagesCount = substr_count($strSystemMessages, 'class="tl_error"');

		$this->setImpersonatedLogout();

		// Front end preview links
		if (\defined('CURRENT_ID') && CURRENT_ID != '')
		{
			if (Input::get('do') == 'page')
			{
				$this->Template->frontendFile = '?page=' . CURRENT_ID;
			}
			elseif (Input::get('do') == 'article' && ($objArticle = ArticleModel::findByPk(CURRENT_ID)) !== null)
			{
				$this->Template->frontendFile = '?page=' . $objArticle->pid;
			}
			elseif (Input::get('do') != '')
			{
				$event = new PreviewUrlCreateEvent(Input::get('do'), CURRENT_ID);
				$container->get('event_dispatcher')->dispatch(ContaoCoreEvents::PREVIEW_URL_CREATE, $event);

				if (($strQuery = $event->getQuery()) !== null)
				{
					$this->Template->frontendFile = '?' . $strQuery;
				}
			}
		}

		return $this->Template->getResponse();
	}
protected function output()
	{
		// Default headline
		if ($this->Template->headline == '')
		{
			$this->Template->headline = $GLOBALS['TL_LANG']['MSC']['dashboard'];
		}

		// Default title
		if ($this->Template->title == '')
		{
			$this->Template->title = $this->Template->headline;
		}

		$container = System::getContainer();
		$objSession = $container->get('session');

		// File picker reference (backwards compatibility)
		if (Input::get('popup') && Input::get('act') != 'show' && ((Input::get('do') == 'page' && $this->User->hasAccess('page', 'modules')) || (Input::get('do') == 'files' && $this->User->hasAccess('files', 'modules'))) && $objSession->get('filePickerRef'))
		{
			$this->Template->managerHref = ampersand($objSession->get('filePickerRef'));
			$this->Template->manager = (strpos($objSession->get('filePickerRef'), 'contao/page?') !== false) ? $GLOBALS['TL_LANG']['MSC']['pagePickerHome'] : $GLOBALS['TL_LANG']['MSC']['filePickerHome'];
		}

		$referer = null;

		if ($request = $container->get('request_stack')->getCurrentRequest())
		{
			$referer = base64_encode($request->getQueryString());
		}

		$this->Template->theme = Backend::getTheme();
		$this->Template->base = Environment::get('base');
		$this->Template->language = $GLOBALS['TL_LANGUAGE'];
		$this->Template->title = StringUtil::specialchars(strip_tags($this->Template->title));
		$this->Template->host = Environment::get('host');
		$this->Template->charset = Config::get('characterSet');
		$this->Template->account = $GLOBALS['TL_LANG']['MOD']['login'][1];
		$this->Template->preview = $GLOBALS['TL_LANG']['MSC']['fePreview'];
		$this->Template->previewTitle = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['fePreviewTitle']);
		$this->Template->profile = $GLOBALS['TL_LANG']['MSC']['profile'];
		$this->Template->canDebug = $this->User->isAdmin;
		$this->Template->isDebug = $container->get('kernel')->isDebug();
		$this->Template->debug = $container->get('kernel')->isDebug() ? $GLOBALS['TL_LANG']['MSC']['disableDebugMode'] : $GLOBALS['TL_LANG']['MSC']['enableDebugMode'];
		$this->Template->referer = $referer;
		$this->Template->profileTitle = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['profileTitle']);
		$this->Template->security = $GLOBALS['TL_LANG']['MSC']['security'];
		$this->Template->pageOffset = (int) Input::cookie('BE_PAGE_OFFSET');
		$this->Template->logout = $GLOBALS['TL_LANG']['MSC']['logoutBT'];
		$this->Template->logoutLink = System::getContainer()->get('security.logout_url_generator')->getLogoutUrl();
		$this->Template->logoutTitle = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['logoutBTTitle']);
		$this->Template->user = $this->User;
		$this->Template->username = $GLOBALS['TL_LANG']['MSC']['user'] . ' ' . $this->User->getUsername();
		$this->Template->request = ampersand(Environment::get('request'));
		$this->Template->top = $GLOBALS['TL_LANG']['MSC']['backToTop'];
		$this->Template->modules = $this->User->navigation();
		$this->Template->home = $GLOBALS['TL_LANG']['MSC']['home'];
		$this->Template->homeTitle = $GLOBALS['TL_LANG']['MSC']['homeTitle'];
		$this->Template->backToTop = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['backToTopTitle']);
		$this->Template->expandNode = $GLOBALS['TL_LANG']['MSC']['expandNode'];
		$this->Template->collapseNode = $GLOBALS['TL_LANG']['MSC']['collapseNode'];
		$this->Template->loadingData = $GLOBALS['TL_LANG']['MSC']['loadingData'];
		$this->Template->isPopup = Input::get('popup');
		$this->Template->systemMessages = $GLOBALS['TL_LANG']['MSC']['systemMessages'];
		$this->Template->burger = $GLOBALS['TL_LANG']['MSC']['burgerTitle'];
		$this->Template->learnMore = sprintf($GLOBALS['TL_LANG']['MSC']['learnMore'], '<a href="https://contao.org" target="_blank" rel="noreferrer noopener">contao.org</a>');
		$this->Template->ref = $container->get('request_stack')->getCurrentRequest()->attributes->get('_contao_referer_id');
		$this->Template->menu = $container->get('contao.menu.backend_menu_renderer')->render($container->get('contao.menu.backend_menu_builder')->create());
		$this->Template->headerNavigation = StringUtil::specialchars($GLOBALS['TL_LANG']['MSC']['headerNavigation']);

		$strSystemMessages = Backend::getSystemMessages();
		$this->Template->systemMessagesCount = substr_count($strSystemMessages, 'class="tl_');
		$this->Template->systemErrorMessagesCount = substr_count($strSystemMessages, 'class="tl_error"');

		$this->setImpersonatedLogout();

		// Front end preview links
		if (\defined('CURRENT_ID') && CURRENT_ID != '')
		{
			if (Input::get('do') == 'page')
			{
				$this->Template->frontendFile = '?page=' . CURRENT_ID;
			}
			elseif (Input::get('do') == 'article' && ($objArticle = ArticleModel::findByPk(CURRENT_ID)) !== null)
			{
				$this->Template->frontendFile = '?page=' . $objArticle->pid;
			}
			elseif (Input::get('do') != '')
			{
				$event = new PreviewUrlCreateEvent(Input::get('do'), CURRENT_ID);
				$container->get('event_dispatcher')->dispatch(ContaoCoreEvents::PREVIEW_URL_CREATE, $event);

				if (($strQuery = $event->getQuery()) !== null)
				{
					$this->Template->frontendFile = '?' . $strQuery;
				}
			}
		}

		return $this->Template->getResponse();
	}
Output the template file

@return Response