[BUGFIX] EXT:form - use configured finisher identifiers for translations 43/53843/2
authorRalf Zimmermann <ralf.zimmermann@tritum.de>
Fri, 30 Jun 2017 08:12:19 +0000 (10:12 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Thu, 31 Aug 2017 13:34:38 +0000 (15:34 +0200)
Use the configured finisher identifier for translation keys instead of
the finisher class name.

Resolves: #81591
Releases: master, 8.7
Change-Id: Ib78e942121b4b6e299ae394c30261603760444f7
Reviewed-on: https://review.typo3.org/53843
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/form/Classes/Domain/Finishers/AbstractFinisher.php
typo3/sysext/form/Classes/Domain/Model/FormDefinition.php

index 1b560fb..38b957c 100644 (file)
@@ -78,6 +78,20 @@ abstract class AbstractFinisher implements FinisherInterface
     }
 
     /**
+     * @param string $finisherIdentifier The identifier for this finisher
+     */
+    public function __construct(string $finisherIdentifier = '')
+    {
+        if (empty($finisherIdentifier)) {
+            $this->finisherIdentifier = (new \ReflectionClass($this))->getShortName();
+        } else {
+            $this->finisherIdentifier = $finisherIdentifier;
+        }
+
+        $this->shortFinisherIdentifier = preg_replace('/Finisher$/', '', $this->finisherIdentifier);
+    }
+
+    /**
      * @param array $options configuration options in the format ['option1' => 'value1', 'option2' => 'value2', ...]
      * @api
      */
@@ -106,8 +120,6 @@ abstract class AbstractFinisher implements FinisherInterface
      */
     final public function execute(FinisherContext $finisherContext)
     {
-        $this->finisherIdentifier = (new \ReflectionClass($this))->getShortName();
-        $this->shortFinisherIdentifier = preg_replace('/Finisher$/', '', $this->finisherIdentifier);
         $this->finisherContext = $finisherContext;
         $this->executeInternal();
     }
index 7eb6122..e496c68 100644 (file)
@@ -500,7 +500,7 @@ class FormDefinition extends AbstractCompositeRenderable
             $defaultOptions = isset($this->finishersDefinition[$finisherIdentifier]['options']) ? $this->finishersDefinition[$finisherIdentifier]['options'] : [];
             ArrayUtility::mergeRecursiveWithOverrule($defaultOptions, $options);
 
-            $finisher = $this->objectManager->get($implementationClassName);
+            $finisher = $this->objectManager->get($implementationClassName, $finisherIdentifier);
             $finisher->setOptions($defaultOptions);
             $this->addFinisher($finisher);
             return $finisher;