Skip to content

Commit

Permalink
Merge pull request #16 from 80Quattro/bugfix_preview_mode
Browse files Browse the repository at this point in the history
[BUGFIX] Configuration - Request in ext:Form Preview Mode
  • Loading branch information
80Quattro authored Apr 2, 2024
2 parents 17c555b + f51826c commit d6573ca
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
3 changes: 2 additions & 1 deletion Classes/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;

Expand All @@ -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();
Expand Down
8 changes: 6 additions & 2 deletions Classes/ViewHelpers/ConfigurationViewHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -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();
}
}
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@
],
],
'state' => 'beta',
'version' => '0.1.2',
'version' => '0.1.3',
];

0 comments on commit d6573ca

Please sign in to comment.