diff --git a/Classes/Configuration.php b/Classes/Configuration.php index 7d250d7..22eac13 100644 --- a/Classes/Configuration.php +++ b/Classes/Configuration.php @@ -5,6 +5,7 @@ namespace StudioMitte\FriendlyCaptcha; use TYPO3\CMS\Core\Core\Environment; +use TYPO3\CMS\Core\Site\Entity\NullSite; use TYPO3\CMS\Core\Site\Entity\Site; use TYPO3\CMS\Core\Utility\GeneralUtility; @@ -24,7 +25,7 @@ public function __construct(Site $site = null) if ($site === null) { $site = $GLOBALS['TYPO3_REQUEST']->getAttribute('site'); } - if ($site === null) { + if ($site === null || $site instanceof NullSite) { return; } $siteConfiguration = $site->getConfiguration(); diff --git a/Classes/ViewHelpers/ConfigurationViewHelper.php b/Classes/ViewHelpers/ConfigurationViewHelper.php index 66e3854..a9ef545 100644 --- a/Classes/ViewHelpers/ConfigurationViewHelper.php +++ b/Classes/ViewHelpers/ConfigurationViewHelper.php @@ -29,9 +29,13 @@ public static function renderStatic(array $arguments, \Closure $renderChildrenCl protected static function getLanguageIsoCode(): string { + $language = $GLOBALS['TYPO3_REQUEST']->getAttribute('language'); + if(!$language) { + return ''; + } if ((new Typo3Version())->getMajorVersion() >= 12) { - return $GLOBALS['TYPO3_REQUEST']->getAttribute('language')->getLocale()->getLanguageCode(); + return $language->getLocale()->getLanguageCode(); } - return $GLOBALS['TYPO3_REQUEST']->getAttribute('language')->getTwoLetterIsoCode(); + return $language->getTwoLetterIsoCode(); } } diff --git a/ext_emconf.php b/ext_emconf.php index d50046a..8111848 100644 --- a/ext_emconf.php +++ b/ext_emconf.php @@ -17,5 +17,5 @@ ], ], 'state' => 'beta', - 'version' => '0.1.2', + 'version' => '0.1.3', ];