[BUGFIX] _LOCAL_LANG overwrite via TypoScript with nested keys 04/53704/2
authorSusanne Moog <s.moog@neusta.de>
Tue, 15 Aug 2017 07:41:08 +0000 (09:41 +0200)
committerAndreas Fernandez <typo3@scripting-base.de>
Tue, 15 Aug 2017 11:17:13 +0000 (13:17 +0200)
If language labels are set for the top level key and sub
keys in TypoScript the top level key was not taken into
account as it got stored with 'typoScriptNodeValue' as key.

Special handling for that specific key was introduced, to
make overwriting of top level keys possible again.

Change-Id: Ibd5f5a939b1de530ba93840cfb7ba5ab5bc85c2f
Resolves: #81095
Releases: master, 8.7
Reviewed-on: https://review.typo3.org/53704
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Tested-by: Andreas Fernandez <typo3@scripting-base.de>
typo3/sysext/extbase/Classes/Utility/LocalizationUtility.php
typo3/sysext/extbase/Tests/Unit/Utility/LocalizationUtilityTest.php

index 60968bd..c46fdac 100644 (file)
@@ -255,7 +255,11 @@ class LocalizationUtility
         $result = [];
         foreach ($labelValues as $key => $labelValue) {
             if (!empty($parentKey)) {
-                $key = $parentKey . '.' . $key;
+                if ($key === '_typoScriptNodeValue') {
+                    $key = $parentKey;
+                } else {
+                    $key = $parentKey . '.' . $key;
+                }
             }
             if (is_array($labelValue)) {
                 $labelValue = self::flattenTypoScriptLabelArray($labelValue, $key);
index 9e6aa7d..f1719e8 100644 (file)
@@ -195,6 +195,7 @@ class LocalizationUtilityTest extends \TYPO3\TestingFramework\Core\Unit\UnitTest
         $expected = [
             'key1' => 'value1',
             'key2' => 'value2',
+            'key3' => 'value3',
             'key3.subkey1' => 'subvalue1',
             'key3.subkey2.subsubkey' => 'val'
         ];
@@ -202,6 +203,7 @@ class LocalizationUtilityTest extends \TYPO3\TestingFramework\Core\Unit\UnitTest
             'key1' => 'value1',
             'key2' => 'value2',
             'key3' => [
+                '_typoScriptNodeValue' => 'value3',
                 'subkey1' => 'subvalue1',
                 'subkey2' => [
                     'subsubkey' => 'val'