Ejemplo n.º 1
0
 /**
  * Generate FE page
  * Override TL_PTY.regular
  *
  * @param      $objPage
  * @param bool $blnCheckRequest
  */
 function generate($objPage, $blnCheckRequest = false)
 {
     self::fixupCurrentLanguage();
     // Check if default language
     if ($GLOBALS['TL_LANGUAGE'] === $this->domainLanguages['default']) {
         // if default language is not published, give error
         if (empty($objPage->i18nl10n_published)) {
             /** @var  \Contao\PageError404  $objError */
             $objError = new $GLOBALS['TL_PTY']['error_404']();
             $objError->generate($objPage->id);
         }
         self::addAlternativeLanguageLinks($objPage);
         parent::generate($objPage, $blnCheckRequest);
         return;
     }
     // Try to get translated page
     $objPage = I18nl10n::getInstance()->findPublishedL10nPage($objPage);
     // If neither fallback nor localization are published and null
     // was given, give error 404
     if (!$objPage) {
         /** @var  \Contao\PageError404  $objError */
         $objError = new $GLOBALS['TL_PTY']['error_404']();
         $objError->generate($objPage->id);
     }
     self::addAlternativeLanguageLinks($objPage);
     parent::generate($objPage, $blnCheckRequest);
 }