[TASK] Ensure version placeholders get updated on slug changes 50/58150/3
authorOliver Hader <oliver@typo3.org>
Mon, 3 Sep 2018 18:46:26 +0000 (20:46 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Mon, 3 Sep 2018 21:02:21 +0000 (23:02 +0200)
This change ensures that workspace version placeholders are kept
in sync when slug values (TCA type 'slug') are modified in their
specific workspace version. This is done implicitly without the
requirement to define shadowColumnsForNewPlaceholders in TCA.

Resolves: #86117
Releases: master
Change-Id: I11baab1e2154b5f3a043a29c08617c0ad360226a
Reviewed-on: https://review.typo3.org/58150
Tested-by: TYPO3com <no-reply@typo3.com>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Benni Mack <benni@typo3.org>
Reviewed-by: Susanne Moog <susanne.moog@typo3.org>
Tested-by: Susanne Moog <susanne.moog@typo3.org>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/core/Classes/DataHandling/DataHandler.php
typo3/sysext/core/Classes/DataHandling/SlugEnricher.php

index c63e1f5..d9e5d6f 100644 (file)
@@ -1389,6 +1389,7 @@ class DataHandler implements LoggerAwareInterface
                 }
                 $shadowCols .= ',' . $GLOBALS['TCA'][$table]['ctrl']['type'];
                 $shadowCols .= ',' . $GLOBALS['TCA'][$table]['ctrl']['label'];
+                $shadowCols .= ',' . implode(',', GeneralUtility::makeInstance(SlugEnricher::class)->resolveSlugFieldNames($table));
                 $shadowColumns = array_unique(GeneralUtility::trimExplode(',', $shadowCols, true));
                 foreach ($shadowColumns as $fieldName) {
                     if ((string)$justStoredRecord[$fieldName] !== (string)$liveRec[$fieldName] && isset($GLOBALS['TCA'][$table]['columns'][$fieldName]) && $fieldName !== 'uid' && $fieldName !== 'pid') {
index 16e5df2..f43657c 100644 (file)
@@ -87,7 +87,7 @@ class SlugEnricher
      * @param string $tableName
      * @return string[]
      */
-    protected function resolveSlugFieldNames(string $tableName): array
+    public function resolveSlugFieldNames(string $tableName): array
     {
         if (isset($this->slugFieldNamesPerTable[$tableName])) {
             return $this->slugFieldNamesPerTable[$tableName];