[BUGFIX] TCA displayCond with EXT:anExt:LOADED fails 51/44251/5
authorChristian Kuhn <lolli@schwarzbu.ch>
Fri, 23 Oct 2015 15:01:51 +0000 (17:01 +0200)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 23 Oct 2015 17:40:55 +0000 (19:40 +0200)
Due to the new condition evaluation construct in FormEngine, the
EXT:anExtension:LOADED display condition is very unfortunate since
the evaluation happens at the end, and depending on the configuration
of affected field, the former data provider may fail fetching data.

This is solved by deprecating this condition since it works contrary
to the "additive" TCA system: Extensions should always add or change
other extensions TCA, but should not have a "negative" dependency
to each other like "Don't do if that extension is loaded".

Core is affected at two places in combination with
static_info_tables. This also lowers the dependency from core
to static_info_tables again, which is not a good thing in
first place.

A patch for static_info_tables adding the fields there is pending.

Resolves: #70052
Releases: master
Change-Id: Iccb7a116d1f89e55e80e389a2448759eca326605
Reviewed-on: https://review.typo3.org/44251
Reviewed-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Tested-by: Morton Jonuschat <m.jonuschat@mojocode.de>
Reviewed-by: Jan Helke <typo3@helke.de>
Tested-by: Jan Helke <typo3@helke.de>
Reviewed-by: Christian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn <lolli@schwarzbu.ch>
typo3/sysext/backend/Classes/Form/FormDataProvider/EvaluateDisplayConditions.php
typo3/sysext/core/Configuration/TCA/sys_language.php
typo3/sysext/core/Documentation/Changelog/master/Deprecation-70052-ExtLoadedDisplayCondition.rst [new file with mode: 0644]
typo3/sysext/rtehtmlarea/Configuration/TCA/tx_rtehtmlarea_acronym.php

index e3463f0..ce89d25 100644 (file)
@@ -299,9 +299,11 @@ class EvaluateDisplayConditions implements FormDataProviderInterface
      *
      * @param string $condition
      * @return bool
+     * @deprecated since TYPO3 CMS 7, will be removed in TYPO3 CMS 8 - Do not use EXT:LOADED display conditions any longer
      */
     protected function matchExtensionCondition($condition)
     {
+        GeneralUtility::logDeprecatedFunction();
         $result = false;
         list($extensionKey, $operator, $operand) = explode(':', $condition, 3);
         if ($operator === 'LOADED') {
index 69fa06c..0fbe272 100644 (file)
@@ -51,23 +51,6 @@ return array(
                 'itemsProcFunc' => \TYPO3\CMS\Core\Service\IsoCodeService::class . '->renderIsoCodeSelectDropdown',
             )
         ),
-        'static_lang_isocode' => array(
-            'exclude' => 1,
-            'label' => 'LLL:EXT:lang/locallang_tca.xlf:sys_language.isocode',
-            'displayCond' => 'EXT:static_info_tables:LOADED:true',
-            'config' => array(
-                'type' => 'select',
-                'renderType' => 'selectSingle',
-                'items' => array(
-                    array('', 0)
-                ),
-                'foreign_table' => 'static_languages',
-                'foreign_table_where' => 'AND static_languages.pid=0 ORDER BY static_languages.lg_name_en',
-                'size' => 1,
-                'minitems' => 0,
-                'maxitems' => 1
-            )
-        ),
         'flag' => array(
             'label' => 'LLL:EXT:lang/locallang_tca.xlf:sys_language.flag',
             'config' => array(
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Deprecation-70052-ExtLoadedDisplayCondition.rst b/typo3/sysext/core/Documentation/Changelog/master/Deprecation-70052-ExtLoadedDisplayCondition.rst
new file mode 100644 (file)
index 0000000..052df87
--- /dev/null
@@ -0,0 +1,37 @@
+======================================================
+Deprecation: #70052 - TCA Display condition EXT LOADED
+======================================================
+
+Description
+===========
+
+In ``TCA`` the ``EXT:anExtension:LOADED`` display condition has been deprecated.
+
+
+Affected Installations
+======================
+
+Extensions that use ``LOADED`` display conditions. Those can be located by
+searching for ``LOADED`` in the backend module ``Configuration`` ``TCA`` section,
+example match from rtehtmlarea:
+
+.. code-block:: php
+
+    'static_lang_isocode' => array(
+        'displayCond' => 'EXT:static_info_tables:LOADED:true',
+        'config' => ...
+        ...
+    ),
+
+
+Migration
+=========
+
+Do not use any longer. ``TCA`` works additive, so the extension that is referenced in
+``EXT:LOADED:extensionName`` should instead add columns definition instead of the
+referring extension defining the ``TCA`` conditional. In the example above, the
+column definition of ``static_lang_isocode`` was removed from extension ``rtehtmlarea``
+and moved to extension ``static_info_tables``, adding the field in an
+``Configuration/TCA/Overrides`` file to the affected table. To ensure the load order
+of extensions is correct, ``static_info_tables`` could set a ``suggest`` dependency
+``rtehtmlarea``.
index 207a5c0..e603603 100644 (file)
@@ -99,36 +99,10 @@ return array(
                 'eval' => 'trim,required'
             )
         ),
-        'static_lang_isocode' => array(
-            'exclude' => 0,
-            'label' => 'LLL:EXT:rtehtmlarea/Resources/Private/Language/locallang_db.xlf:tx_rtehtmlarea_acronym.static_lang_isocode',
-            'displayCond' => 'EXT:static_info_tables:LOADED:true',
-            'config' => array(
-                'type' => 'select',
-                'renderType' => 'selectSingle',
-                'items' => array(
-                    array('', 0),
-                ),
-                'foreign_table' => 'static_languages',
-                'foreign_table_where' => 'ORDER BY static_languages.lg_name_en',
-                'itemsProcFunc' => SJBR\StaticInfoTables\Hook\Backend\Form\FormDataProvider\TcaSelectItemsProcessor::class. '->translateLanguagesSelector',
-                'size' => 1,
-                'minitems' => 0,
-                'maxitems' => 1,
-                'wizards' => array(
-                    'suggest' => array(
-                        'type' => 'suggest',
-                        'default' => array(
-                            'receiverClass' => SJBR\StaticInfoTables\Hook\Backend\Form\Wizard\SuggestReceiver::class
-                        )
-                    )
-                )
-            )
-        )
     ),
     'types' => array(
         '0' => array(
-            'showitem' => 'hidden, --palette--;;1, sys_language_uid, type, term, acronym, static_lang_isocode',
+            'showitem' => 'hidden, --palette--;;1, sys_language_uid, type, term, acronym',
         ),
     ),
     'palettes' => array(