Skip to content

Commit

Permalink
bugfix for PHP 8.1 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
t-schramm committed Mar 10, 2023
1 parent 8610d1e commit 45c3416
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ public function getDataToStore(ServerRequestInterface $request): ModuleData
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
return new ModuleData(
[
'labels' => $GLOBALS['TRANSLATELABELS'],
'labels' => $GLOBALS['TRANSLATELABELS'] ?? [],
'showTranslateLabels' => $this->configurationService->getConfigurationOption('translatelabels', 'showTranslationLabels'),
'saveUrl' => $this->generateBackendUrl('ajax_translatelabels_translate'),
'sysLanguageUid' => $this->context->getPropertyFromAspect('language', 'id'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public function getDataToStore(ServerRequestInterface $request): ModuleData
$iconFactory = GeneralUtility::makeInstance(IconFactory::class);
return new ModuleData(
[
'labels' => $GLOBALS['TRANSLATELABELS'],
'labels' => $GLOBALS['TRANSLATELABELS'] ?? [],
'showTranslateLabels' => $this->configurationService->getConfigurationOption('translatelabels', 'showTranslationLabels'),
'editIcon' => $iconFactory->getIcon('actions-open', Icon::SIZE_SMALL)->render()
]
Expand Down
3 changes: 2 additions & 1 deletion Classes/Renderer/FrontendRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -222,14 +222,15 @@ protected function getOverrides(int $pid, string $labelKey, string $extensionNam
}
}
$pluginName = (strpos($extensionName, 'tx_') === 0) ? $extensionName : 'tx_' . strtolower($extensionName);
$typoScriptOverride = [];
if (isset($GLOBALS['TSFE']->tmpl->setup['plugin.'][$pluginName . '.']['_LOCAL_LANG.'][$languageKey . '.']) &&
is_array($GLOBALS['TSFE']->tmpl->setup['plugin.'][$pluginName . '.']['_LOCAL_LANG.'][$languageKey . '.'])) {
$typoScriptOverride = ArrayUtility::flatten(
$GLOBALS['TSFE']->tmpl->setup['plugin.'][$pluginName . '.']['_LOCAL_LANG.'][$languageKey . '.'],
'.'
);
}
if ($typoScriptOverride['.' . $labelName]) {
if (!empty($typoScriptOverride['.' . $labelName])) {
$overrides[] = ['TypoScript' , 'plugin.' . $pluginName . '._LOCAL_LANG.' . $languageKey . '.' . $labelName];
}
if (TranslationLabelUtility::getLabelFromDatabase($labelKey, $pid) !== null) {
Expand Down
2 changes: 1 addition & 1 deletion Classes/Utility/TranslationLabelUtility.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public static function getDefaultLanguageFile($extensionName)
public static function getExtendLabelKeyWithLanguageFilePath($labelKey, $extensionName)
{
$reversedParts = explode(':', strrev($labelKey), 2);
$languageFile = strrev($reversedParts[1]);
$languageFile = strrev($reversedParts[1] ?? '');
$extendedLabelKey = $labelKey;
if ($languageFile === '') {
// $extendedLabelKey = 'LLL:EXT:' . self::getDefaultLanguageFile($extensionName) . ':' . $labelKey;
Expand Down
2 changes: 1 addition & 1 deletion ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
'author' => 'Alexander Bohndorf',
'author_email' => '[email protected]',
'state' => 'beta',
'version' => '2.2.1',
'version' => '2.3.0',
'constraints' => [
'depends' => [
'typo3' => '10.0.0-11.5.99',
Expand Down

0 comments on commit 45c3416

Please sign in to comment.