Commit f0d038e4 authored by Christian Kuhn's avatar Christian Kuhn
Browse files

[BUGFIX] Fatal in ext:form using LanguageServiceFactory

Patch #94414 broke a case in ext:form leading to a
fatal, easily reproducible when opening a content
element having a form.
The class is internal and only used in backend
through a hook and can thus rely on GLOBALS['LANG']
like so many other backend classes do.

Resolves: #94429
Related: #94414
Releases: master
Change-Id: I578d3b1d61894c210bb0fb20cddf44307cb40ae2
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/69653


Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: core-ci's avatarcore-ci <typo3@b13.com>
Tested-by: Jochen's avatarJochen <rothjochen@gmail.com>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Reviewed-by: Jochen's avatarJochen <rothjochen@gmail.com>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent c7745b1f
......@@ -17,10 +17,9 @@ declare(strict_types=1);
namespace TYPO3\CMS\Form\Domain\Configuration\FlexformConfiguration\Processors;
use TYPO3\CMS\Core\Localization\LanguageServiceFactory;
use TYPO3\CMS\Core\Localization\LanguageService;
use TYPO3\CMS\Core\Utility\ArrayUtility;
use TYPO3\CMS\Core\Utility\Exception\MissingArrayPathException;
use TYPO3\CMS\Core\Utility\GeneralUtility;
/**
* Generate a FlexForm element for a finisher option
......@@ -29,22 +28,6 @@ use TYPO3\CMS\Core\Utility\GeneralUtility;
*/
class FinisherOptionGenerator extends AbstractProcessor
{
/**
* @var \TYPO3\CMS\Core\Localization\LanguageServiceFactory
*/
protected $languageService;
/**
* @param ProcessorDto $converterDto
*/
public function __construct(ProcessorDto $converterDto)
{
parent::__construct($converterDto);
$this->languageService = GeneralUtility::makeInstance(LanguageServiceFactory::class);
$this->languageService->includeLLFile('EXT:form/Resources/Private/Language/Database.xlf');
}
/**
* @param string $_ unused in this context
* @param mixed $__ unused in this context
......@@ -89,10 +72,11 @@ class FinisherOptionGenerator extends AbstractProcessor
} catch (MissingArrayPathException $exception) {
}
$languageService = $this->getLanguageService();
if (empty($optionValue)) {
$elementConfiguration['label'] .= sprintf(' (%s: "%s")', $this->languageService->getLL('default'), $this->languageService->getLL('empty'));
$elementConfiguration['label'] .= sprintf(' (%s: "%s")', $languageService->getLL('default'), $languageService->getLL('empty'));
} else {
$elementConfiguration['label'] .= sprintf(' (%s: "' . $optionValue . '")', $this->languageService->getLL('default'));
$elementConfiguration['label'] .= sprintf(' (%s: "' . $optionValue . '")', $languageService->getLL('default'));
}
if (isset($elementConfiguration['config'])) {
......@@ -104,4 +88,9 @@ class FinisherOptionGenerator extends AbstractProcessor
$this->converterDto->setResult($sheetElements);
}
protected function getLanguageService(): LanguageService
{
return $GLOBALS['LANG'];
}
}
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment