[!!!][TASK] TCA: Remove wizard _HIDDENFIELD and hideParent 50/41150/3
authorChristian Kuhn <lolli@schwarzbu.ch>
Mon, 13 Jul 2015 20:20:09 +0000 (22:20 +0200)
committerBenjamin Mack <benni@typo3.org>
Tue, 14 Jul 2015 08:30:48 +0000 (10:30 +0200)
The functionality provided by _HIDDENFIELD and hideParent on TCA
wizard level can be better realized with the new renderType
registration provided by the NodeFactory. A search showed that
not a single TER extension used the two options, and it is probably
also used very rarely in other 3rd party extensions. It is dropped
now without substitution.

Resolves: #68092
Releases: master
Change-Id: I95fb96561e1879e302ba927d70d72bd454b7fa15
Reviewed-on: http://review.typo3.org/41150
Reviewed-by: Wouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: Georg Ringer <georg.ringer@gmail.com>
Tested-by: Georg Ringer <georg.ringer@gmail.com>
Reviewed-by: Benjamin Mack <benni@typo3.org>
Tested-by: Benjamin Mack <benni@typo3.org>
typo3/sysext/backend/Classes/Form/Element/AbstractFormElement.php
typo3/sysext/backend/Classes/Form/Element/GroupElement.php
typo3/sysext/backend/Classes/Form/Element/InputElement.php
typo3/sysext/backend/Classes/Form/Element/SelectCheckBoxElement.php
typo3/sysext/backend/Classes/Form/Element/SelectMultipleSideBySideElement.php
typo3/sysext/backend/Classes/Form/Element/SelectSingleBoxElement.php
typo3/sysext/backend/Classes/Form/Element/SelectSingleElement.php
typo3/sysext/backend/Classes/Form/Element/SelectTreeElement.php
typo3/sysext/backend/Classes/Form/Element/TextElement.php
typo3/sysext/core/Documentation/Changelog/master/Breaking-68092-TcaRemoveWizardHideParent.rst [new file with mode: 0644]
typo3/sysext/rtehtmlarea/Classes/Form/Element/RichTextElement.php

index 8001442..b3c681e 100644 (file)
@@ -101,7 +101,7 @@ abstract class AbstractFormElement extends AbstractNode {
        /**
         * Rendering wizards for form fields.
         *
-        * @param array $itemKinds Array with the real item in the first value, and an alternative item in the second value.
+        * @param array $itemKinds Array with the real item in the first value
         * @param array $wizConf The "wizard" key from the config array for the field (from TCA)
         * @param string $table Table name
         * @param array $row The record array
@@ -405,34 +405,10 @@ abstract class AbstractFormElement extends AbstractNode {
                                        $otherWizards[] = $suggestWizard->renderSuggestSelector($PA['itemFormElName'], $table, $field, $row, $PA);
                                        break;
                        }
-
-                       // Hide the real form element?
-                       if (is_array($wizardConfiguration['hideParent']) || $wizardConfiguration['hideParent']) {
-                               // Setting the item to a hidden-field.
-                               $item = $itemKinds[1];
-                               if (is_array($wizardConfiguration['hideParent'])) {
-                                       $options = $this->globalOptions;
-                                       $options['parameterArray'] = array(
-                                               'fieldConf' => array(
-                                                       'config' => $wizardConfiguration['hideParent'],
-                                               ),
-                                               'itemFormElValue' => $PA['itemFormElValue'],
-                                       );
-                                       $options['renderType'] = 'none';
-                                       /** @var NodeFactory $nodeFactory */
-                                       $nodeFactory = $this->globalOptions['nodeFactory'];
-                                       $noneElementResult = $nodeFactory->create($options)->render();
-                                       $item .= $noneElementResult['html'];
-                               }
-                       }
                }
 
                // For each rendered wizard, put them together around the item.
                if (!empty($buttonWizards) || !empty($otherWizards)) {
-                       if ($wizConf['_HIDDENFIELD']) {
-                               $item = $itemKinds[1];
-                       }
-
                        $innerContent = '';
                        if (!empty($buttonWizards)) {
                                $innerContent .= '<div class="btn-group' . ($wizConf['_VERTICAL'] ? ' btn-group-vertical' : '') . '">' . implode('', $buttonWizards) . '</div>';
index c3278fd..ab34e4e 100644 (file)
@@ -324,13 +324,9 @@ class GroupElement extends AbstractFormElement {
                                break;
                }
                // Wizards:
-               $altItem = '<input type="hidden" name="' . $parameterArray['itemFormElName'] . '" value="' . htmlspecialchars($parameterArray['itemFormElValue']) . '" />';
                if (!$disabled) {
                        $html = $this->renderWizards(
-                               array(
-                                       $html,
-                                       $altItem
-                               ),
+                               array($html),
                                $config['wizards'],
                                $table,
                                $row,
index 8186a77..bb319c6 100644 (file)
@@ -228,14 +228,9 @@ class InputElement extends AbstractFormElement {
                                </div>';
                }
 
-               // Creating an alternative item without the JavaScript handlers.
-               $altItem = '
-                       <input type="hidden" name="' . htmlspecialchars($parameterArray['itemFormElName']) . '_hr" value="" />
-                       <input type="hidden" name="' . htmlspecialchars($parameterArray['itemFormElName']) . '" value="' . htmlspecialchars($parameterArray['itemFormElValue']) . '" />';
-
                // Wrap a wizard around the item?
                $html = $this->renderWizards(
-                       array($html, $altItem),
+                       array($html),
                        $config['wizards'],
                        $table,
                        $row,
index 0c2bd92..a24dc3e 100644 (file)
@@ -61,8 +61,7 @@ class SelectCheckBoxElement extends AbstractFormElement {
 
                // Wizards:
                if (!$disabled) {
-                       $altItem = '<input type="hidden" name="' . $parameterArray['itemFormElName'] . '" value="' . htmlspecialchars($parameterArray['itemFormElValue']) . '" />';
-                       $html = $this->renderWizards(array($html, $altItem), $config['wizards'], $table, $row, $field, $parameterArray, $parameterArray['itemFormElName'], $specConf);
+                       $html = $this->renderWizards(array($html), $config['wizards'], $table, $row, $field, $parameterArray, $parameterArray['itemFormElName'], $specConf);
                }
                $this->resultArray['html'] = $html;
                return $this->resultArray;
index 8ac89e3..0d44f76 100644 (file)
@@ -63,8 +63,7 @@ class SelectMultipleSideBySideElement extends AbstractFormElement {
 
                // Wizards:
                if (!$disabled) {
-                       $altItem = '<input type="hidden" class="t3js-select-hidden-field" name="' . $parameterArray['itemFormElName'] . '" value="' . htmlspecialchars($parameterArray['itemFormElValue']) . '" />';
-                       $html = $this->renderWizards(array($html, $altItem), $config['wizards'], $table, $row, $field, $parameterArray, $parameterArray['itemFormElName'], $specConf);
+                       $html = $this->renderWizards(array($html), $config['wizards'], $table, $row, $field, $parameterArray, $parameterArray['itemFormElName'], $specConf);
                }
                $this->resultArray['html'] = $html;
                return $this->resultArray;
index cc3ff37..1f0cb89 100644 (file)
@@ -62,8 +62,7 @@ class SelectSingleBoxElement extends AbstractFormElement {
 
                // Wizards:
                if (!$disabled) {
-                       $altItem = '<input type="hidden" name="' . $parameterArray['itemFormElName'] . '" value="' . htmlspecialchars($parameterArray['itemFormElValue']) . '" />';
-                       $html = $this->renderWizards(array($html, $altItem), $config['wizards'], $table, $row, $field, $parameterArray, $parameterArray['itemFormElName'], $specConf);
+                       $html = $this->renderWizards(array($html), $config['wizards'], $table, $row, $field, $parameterArray, $parameterArray['itemFormElName'], $specConf);
                }
                $this->resultArray['html'] = $html;
                return $this->resultArray;
index 4001e77..d46fd27 100644 (file)
@@ -65,8 +65,7 @@ class SelectSingleElement extends AbstractFormElement {
 
                // Wizards:
                if (!$disabled) {
-                       $altItem = '<input type="hidden" name="' . $parameterArray['itemFormElName'] . '" value="' . htmlspecialchars($parameterArray['itemFormElValue']) . '" />';
-                       $html = $this->renderWizards(array($html, $altItem), $config['wizards'], $table, $row, $field, $parameterArray, $parameterArray['itemFormElName'], $specConf);
+                       $html = $this->renderWizards(array($html), $config['wizards'], $table, $row, $field, $parameterArray, $parameterArray['itemFormElName'], $specConf);
                }
                $this->resultArray['html'] = $html;
                return $this->resultArray;
index d697f5f..b00c907 100644 (file)
@@ -62,8 +62,7 @@ class SelectTreeElement extends AbstractFormElement {
 
                // Wizards:
                if (!$disabled) {
-                       $altItem = '<input type="hidden" name="' . $parameterArray['itemFormElName'] . '" value="' . htmlspecialchars($parameterArray['itemFormElValue']) . '" />';
-                       $html = $this->renderWizards(array($html, $altItem), $config['wizards'], $table, $row, $field, $parameterArray, $parameterArray['itemFormElName'], $specConf);
+                       $html = $this->renderWizards(array($html), $config['wizards'], $table, $row, $field, $parameterArray, $parameterArray['itemFormElName'], $specConf);
                }
                $resultArray['html'] = $html;
                return $resultArray;
index 7e93bca..36474e9 100644 (file)
@@ -92,8 +92,6 @@ class TextElement extends AbstractFormElement {
                $evalList = GeneralUtility::trimExplode(',', $config['eval'], TRUE);
                // "Extra" configuration; Returns configuration for the field based on settings found in the "types" fieldlist. Traditionally, this is where RTE configuration has been found.
                $specialConfiguration = BackendUtility::getSpecConfParts($parameterArray['fieldConf']['defaultExtras']);
-               // Setting up the altItem form field, which is a hidden field containing the value
-               $altItem = '<input type="hidden" name="' . htmlspecialchars($parameterArray['itemFormElName']) . '" value="' . htmlspecialchars($parameterArray['itemFormElValue']) . '" />';
                $html = '';
 
                // Show message, if no RTE (field can only be edited with RTE!)
@@ -178,7 +176,7 @@ class TextElement extends AbstractFormElement {
 
                        // Wrap a wizard around the item?
                        $html = $this->renderWizards(
-                               array($html, $altItem),
+                               array($html),
                                $config['wizards'],
                                $table,
                                $row,
diff --git a/typo3/sysext/core/Documentation/Changelog/master/Breaking-68092-TcaRemoveWizardHideParent.rst b/typo3/sysext/core/Documentation/Changelog/master/Breaking-68092-TcaRemoveWizardHideParent.rst
new file mode 100644 (file)
index 0000000..7ef98fa
--- /dev/null
@@ -0,0 +1,49 @@
+=================================================================
+Breaking: #68092 - TCA: Remove wizard hideParent and _HIDDENFIELD
+=================================================================
+
+Description
+===========
+
+Wizards defined in ``TCA`` for display in ``FormEngine`` allowed to hide the "parent"
+field with the configuration options ``_HIDDENFIELD`` on main wizard level, and with
+the ``hideParent`` option for single wizards.
+
+Both options have been dropped.
+
+
+Impact
+======
+
+The configuration options have no effect anymore, the main field will show up.
+
+
+Affected Installations
+======================
+
+A search through the TER code showed not a single extension that used the above options.
+A 3rd party extension is affected if a ``TCA`` column configuration is used like:
+
+.. code-block:: php
+
+       'aField' => array(
+               'config' => array(
+                       ...
+                       'wizards' => array(
+                               '_HIDDENFIELD' => TRUE,
+                               'aWizard' => array(
+                                       'hideParent' => array(
+                                               ...
+                                       ),
+                               ),
+                       ),
+               ),
+       ),
+
+
+Migration
+=========
+
+Wizards can not trigger that a main field is not rendered anymore. If this kind of functionality
+is needed, it is recommended to register an own ``renderType`` in the ``NodeFactory`` for this
+type of field instead to route the element rendering to an own class.
\ No newline at end of file
index 2b209ce..46ed9a9 100644 (file)
@@ -271,10 +271,7 @@ class RichTextElement extends AbstractFormElement {
                $html = $this->getMainHtml();
 
                $this->resultArray['html'] = $this->renderWizards(
-                       array(
-                               $html,
-                               '<input type="hidden" name="' . htmlspecialchars($parameterArray['itemFormElName']) . '" value="' . htmlspecialchars($parameterArray['itemFormElValue']) . '" />',
-                       ),
+                       array($html),
                        $parameterArray['fieldConf']['config']['wizards'],
                        $table,
                        $row,