[!!!][TASK] Drop TCA option showIfRTE for checkboxes 14/49414/6
authorBenni Mack <benni@typo3.org>
Mon, 8 Aug 2016 07:00:21 +0000 (09:00 +0200)
committerGeorg Ringer <georg.ringer@gmail.com>
Tue, 30 Aug 2016 22:14:23 +0000 (00:14 +0200)
The option showIfRTE on checkboxes did only show up
when the user had the RTE active. This option is removed and
not evaluated anymore in FormEngine.

Resolves: #77592
Releases: master
Change-Id: I0791eb1eb90e3589d41715b798ed631630325c41
Reviewed-on: https://review.typo3.org/49414
Tested-by: Bamboo TYPO3com <info@typo3.com>
Reviewed-by: Andreas Fernandez <typo3@scripting-base.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Philipp Gampe <philipp.gampe@typo3.org>
Tested-by: Philipp Gampe <philipp.gampe@typo3.org>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
typo3/sysext/backend/Classes/Form/Container/SingleFieldContainer.php
typo3/sysext/backend/Classes/Form/Utility/FormEngineUtility.php
typo3/sysext/core/Classes/Migrations/TcaMigration.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-77592-DroppedTCAOptionShowIfRTEInTypecheck.rst [new file with mode: 0644]
typo3/sysext/core/Tests/Unit/Migrations/TcaMigrationTest.php

index e0956f2..fb78cba 100644 (file)
@@ -92,8 +92,6 @@ class SingleFieldContainer extends AbstractContainer
         if (// Return if BE-user has no access rights to this field, @todo: another user access rights check!
             $parameterArray['fieldConf']['exclude'] && !$backendUser->check('non_exclude_fields', $table . ':' . $fieldName)
             || $parameterArray['fieldConf']['config']['type'] === 'passthrough'
-            // @todo: Drop option "showIfRTE" ?
-            || !$backendUser->isRTE() && $parameterArray['fieldConf']['config']['showIfRTE']
             // Return if field should not be rendered in translated records
             || $isOverlay && empty($parameterArray['fieldConf']['l10n_display']) && $parameterArray['fieldConf']['l10n_mode'] === 'exclude'
             // @todo: localizationMode still needs handling!
index dfa119e..877da81 100644 (file)
@@ -45,7 +45,7 @@ class FormEngineUtility
     protected static $allowOverrideMatrix = [
         'input' => ['size', 'max', 'readOnly'],
         'text' => ['cols', 'rows', 'wrap', 'readOnly'],
-        'check' => ['cols', 'showIfRTE', 'readOnly'],
+        'check' => ['cols', 'readOnly'],
         'select' => ['size', 'autoSizeMax', 'maxitems', 'minitems', 'readOnly', 'treeConfig'],
         'group' => ['size', 'autoSizeMax', 'max_size', 'show_thumbs', 'maxitems', 'minitems', 'disable_controls', 'readOnly'],
         'inline' => ['appearance', 'behaviour', 'foreign_label', 'foreign_selector', 'foreign_unique', 'maxitems', 'minitems', 'size', 'autoSizeMax', 'symmetric_label', 'readOnly'],
index dbd9079..250ce7f 100644 (file)
@@ -56,6 +56,7 @@ class TcaMigration
         $tca = $this->migrateColorPickerWizardToRenderType($tca);
         $tca = $this->migrateSelectTreeOptions($tca);
         $tca = $this->migrateTSconfigSoftReferences($tca);
+        $tca = $this->migrateShowIfRteOption($tca);
         // @todo: if showitem/defaultExtras wizards[xy] is migrated to columnsOverrides here, enableByTypeConfig could be dropped
         return $tca;
     }
@@ -834,4 +835,29 @@ class TcaMigration
         }
         return $tca;
     }
+
+    /**
+     * Removes the option "showIfRTE" for TCA type "check"
+     *
+     * @param array $tca Incoming TCA
+     * @return array Migrated TCA
+     */
+    protected function migrateShowIfRteOption(array $tca)
+    {
+        foreach ($tca as $table => &$tableDefinition) {
+            if (!isset($tableDefinition['columns']) || !is_array($tableDefinition['columns'])) {
+                continue;
+            }
+            foreach ($tableDefinition['columns'] as $fieldName => &$fieldConfig) {
+                if (isset($fieldConfig['config']) && $fieldConfig['config']['type'] === 'check') {
+                    if (isset($fieldConfig['config']['showIfRTE'])) {
+                        unset($fieldConfig['config']['showIfRTE']);
+                        $this->messages[] = 'The TCA setting \'showIfRTE\' was removed '
+                            . 'in TCA ' . $table . '[\'columns\'][\'' . $fieldName . '\'][\'config\']';
+                    }
+                }
+            }
+        }
+        return $tca;
+    }
 }
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-77592-DroppedTCAOptionShowIfRTEInTypecheck.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-77592-DroppedTCAOptionShowIfRTEInTypecheck.rst
new file mode 100644 (file)
index 0000000..c58294c
--- /dev/null
@@ -0,0 +1,29 @@
+=============================================================
+Breaking: #77592 - Dropped TCA option showIfRTE in type=check
+=============================================================
+
+Description
+===========
+
+The TCA setting ``showIfRTE`` for type=check is not evaluated anymore, and removed from the TCA on all fields.
+
+
+Impact
+======
+
+All TCA columns having this option set will be shown at any time inside FormEngine. The option is removed from the final TCA
+used inside TYPO3.
+
+The TCA migration will throw a deprecation information when building the final TCA.
+
+
+Affected Installations
+======================
+
+TYPO3 instances using old extensions which provide custom TCA configurations having this option set.
+
+
+Migration
+=========
+
+Remove the setting from the TCA, and if still needed, use a custom display condition to achieve the same functionality.
\ No newline at end of file
index 8a4a41c..9a467e8 100644 (file)
@@ -1682,4 +1682,72 @@ class TcaMigrationTest extends UnitTestCase
         $subject = new TcaMigration();
         $this->assertEquals($expectedConfig, $subject->migrate($givenConfig));
     }
+
+    public function migrateShowIfRTESettingDataProvider()
+    {
+        return [
+            'nothing removed' => [
+                [
+                    'aTable' => [
+                        'columns' => [
+                            'aCol' => [
+                                'config' => [
+                                    'type' => 'check'
+                                ],
+                            ],
+                        ],
+                    ],
+                ],
+                [
+                    'aTable' => [
+                        'columns' => [
+                            'aCol' => [
+                                'config' => [
+                                    'type' => 'check'
+                                ],
+                            ],
+                        ],
+                    ],
+                ]
+            ],
+            'Option removed' => [
+                [
+                    'aTable' => [
+                        'columns' => [
+                            'aCol' => [
+                                'config' => [
+                                    'type' => 'check',
+                                    'showIfRTE' => false
+                                ],
+                            ],
+                        ],
+                    ],
+                ],
+                [
+                    'aTable' => [
+                        'columns' => [
+                            'aCol' => [
+                                'config' => [
+                                    'type' => 'check'
+                                ],
+                            ],
+                        ],
+                    ],
+                ]
+
+            ],
+        ];
+    }
+
+    /**
+     * @test
+     * @dataProvider migrateShowIfRTESettingDataProvider
+     * @param array $givenConfig
+     * @param array $expectedConfig
+     */
+    public function migrateShowIfRTESetting(array $givenConfig, array $expectedConfig)
+    {
+        $subject = new TcaMigration();
+        $this->assertEquals($expectedConfig, $subject->migrate($givenConfig));
+    }
 }