Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Configuration - Request in ext:Form Preview Mode #16

Merged
merged 2 commits into from
Apr 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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',
];
Loading