\TYPO3\CMS\Form\Localization is a singleton class with constructor
parameters. This is an antipattern and broken by design. As an effect
it leads to warnings in unit tests and makes the class unusable
with multiple files.
The patch removes the implementation of the singletonInterface, but
sets the default localization file as default parameter to keep
backwards compatibility.
Change-Id: I3ed5c77c5c3a653c8d5e7259baa64a41c8c20859
Resolves: #42280
Releases: 6.0
Reviewed-on: http://review.typo3.org/15886
Reviewed-by: Steffen Ritter
Reviewed-by: Wouter Wolters
Reviewed-by: Nicole Cordes
Reviewed-by: Christian Kuhn
Tested-by: Christian Kuhn
* @return void
*/
public function initialize(array $typoscript) {
* @return void
*/
public function initialize(array $typoscript) {
- \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\Localization', 'LLL:EXT:form/Resources/Private/Language/locallang_controller.xml');
$this->typoscriptFactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\Domain\\Factory\\TypoScriptFactory');
$this->localizationHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\Localization');
$this->requestHandler = $this->typoscriptFactory->setRequestHandler($typoscript);
$this->typoscriptFactory = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\Domain\\Factory\\TypoScriptFactory');
$this->localizationHandler = \TYPO3\CMS\Core\Utility\GeneralUtility::makeInstance('TYPO3\\CMS\\Form\\Localization');
$this->requestHandler = $this->typoscriptFactory->setRequestHandler($typoscript);
* @package TYPO3
* @subpackage form
*/
* @package TYPO3
* @subpackage form
*/
-class Localization implements \TYPO3\CMS\Core\SingletonInterface {
/**
* File reference to the local language file
/**
* File reference to the local language file
*
* @param string $localLanguageFile File reference to the local language file
*/
*
* @param string $localLanguageFile File reference to the local language file
*/
- public function __construct($localLanguageFile) {
+ public function __construct($localLanguageFile = 'LLL:EXT:form/Resources/Private/Language/locallang_controller.xml') {
$this->localLanguageFile = (string) $localLanguageFile;
}
$this->localLanguageFile = (string) $localLanguageFile;
}