[BUGFIX] Allow maxitem=1 in TCA treeSelect again 71/47971/2
authorAlexander Bigga <alexander.bigga@slub-dresden.de>
Wed, 27 Apr 2016 13:50:31 +0000 (15:50 +0200)
committerFrans Saris <franssaris@gmail.com>
Fri, 29 Apr 2016 12:15:05 +0000 (14:15 +0200)
commit9394446ac1976009e16c99515312112f2fddc099
treeafab15cf0f7abada07a34e0fd42b20e303263df5
parent83735bb205a202166b446f9b3749af6e4de90ba6
[BUGFIX] Allow maxitem=1 in TCA treeSelect again

Introduced with ec7b229 #75519, it was not possible to set maxitem=1 to
TCA treeSelect. This occures e.g. on setting the parent of a
sys_category.

The reason is the "selected" array which gets initialized with all
selected items. If there is no item selected, it is initialized with an
empty value and "selected.lenght" is 1 but should be 0. Selecting a new
value is impossible now.

The proposed path checks if items are selected or not on
initialization.

Change-Id: I0c8d21ad753dccb2d993febde404afc83a39b9b3
Resolves: #75947
Releases: master, 7.6, 6.2
Reviewed-on: https://review.typo3.org/47971
Reviewed-by: Frans Saris <franssaris@gmail.com>
Tested-by: Frans Saris <franssaris@gmail.com>
typo3/sysext/backend/Resources/Public/JavaScript/tree.js