[BUGFIX] Do not save expand state for root node in TCA tree
authorChristoph Gerold <christoph.gerold@dkd.de>
Sun, 2 Sep 2012 10:46:06 +0000 (12:46 +0200)
committerHelmut Hummel <helmut.hummel@typo3.org>
Sun, 30 Sep 2012 12:48:45 +0000 (14:48 +0200)
To avoid a PHP warning: Missing argument for
BackendUserSettings::addToList() the expanded state must
not be saved for the tree root node which does not
have a uid property.

Change-Id: Id6d16525cd68e4ec13f36c8d95d2ecc0cc1bc794
Resolves: #31978
Releases: 4.5, 4.6, 4.7, 6.0
Reviewed-on: http://review.typo3.org/15171
Reviewed-by: Steffen Ritter
Tested-by: Steffen Ritter
Reviewed-by: Helmut Hummel
Tested-by: Helmut Hummel
t3lib/tceforms/class.t3lib_tceforms_tree.php

index 51a28f3..9710bde 100644 (file)
@@ -191,10 +191,14 @@ class t3lib_TCEforms_Tree {
                                        },
                                        checkchange: TYPO3.Components.Tree.TcaCheckChangeHandler,
                                        collapsenode: function(node) {
-                                               top.TYPO3.BackendUserSettings.ExtDirect.removeFromList("tcaTrees." + this.ucId, node.attributes.uid);
+                                               if (node.id !== "root") {
+                                                       top.TYPO3.BackendUserSettings.ExtDirect.removeFromList("tcaTrees." + this.ucId, node.attributes.uid);
+                                               }
                                        },
                                        expandnode: function(node) {
-                                               top.TYPO3.BackendUserSettings.ExtDirect.addToList("tcaTrees." + this.ucId, node.attributes.uid);
+                                               if (node.id !== "root") {
+                                                       top.TYPO3.BackendUserSettings.ExtDirect.addToList("tcaTrees." + this.ucId, node.attributes.uid);
+                                               }
                                        }
                                },
                                tcaMaxItems: ' . ($PA['fieldConf']['config']['maxitems'] ? intval($PA['fieldConf']['config']['maxitems']) : 99999) . ',