[BUGFIX] Check minitems for TCAtree 97/12797/3
authorGeorg Ringer <mail@ringerge.org>
Tue, 3 Jan 2012 14:36:44 +0000 (15:36 +0100)
committerOliver Hader <oliver.hader@typo3.org>
Fri, 1 Mar 2013 17:25:13 +0000 (18:25 +0100)
The TCAtree ignores currently the minitems.
This is however e.g. needed to require input for a relation field.

Change-Id: I41b345f19f845a8b31e791c11a7c4a907d499ad5
Resolves: #25003
Releases: 4.7, 4.6, 4.5
Reviewed-on: https://review.typo3.org/12797
Reviewed-by: Wouter Wolters
Reviewed-by: Marcus Schwemer
Tested-by: Marcus Schwemer
Reviewed-by: Stefan Neufeind
Reviewed-by: Oliver Hader
Tested-by: Oliver Hader
t3lib/class.t3lib_tceforms.php
t3lib/tceforms/class.t3lib_tceforms_tree.php
typo3/jsfunc.tbe_editor.js

index 9205b91..d6c5c1b 100644 (file)
@@ -1566,6 +1566,10 @@ class t3lib_TCEforms {
                } elseif (!strcmp($config['renderMode'], 'tree')) { // Tree renderMode
                        $treeClass = t3lib_div::makeInstance('t3lib_TCEforms_Tree', $this);
                        $item = $treeClass->renderField($table, $field, $row, $PA, $config, $selItems, $nMV_label);
+
+                               // Register the required number of elements
+                       $minitems = max(intval($config['minitems']), 0);
+                       $this->registerRequiredProperty('range', $PA['itemFormElName'], array($minitems, $maxitems, 'imgName' => $table . '_' . $row['uid'] . '_' . $field));
                } else { // Traditional multiple selector box:
                        $item = $this->getSingleField_typeSelect_multiple($table, $field, $row, $PA, $config, $selItems, $nMV_label);
                }
index 9710bde..5b963b3 100644 (file)
@@ -219,7 +219,7 @@ class t3lib_TCEforms_Tree {
 
                $formField = '
                        <div class="typo3-tceforms-tree">
-                               <input type="hidden" name="' . htmlspecialchars($PA['itemFormElName']) . '" id="treeinput' . $id . '" value="' . htmlspecialchars($PA['itemFormElValue']) . '" />
+                               <input class="treeRecord" type="hidden" name="' . htmlspecialchars($PA['itemFormElName']) . '" id="treeinput' . $id . '" value="' . htmlspecialchars($PA['itemFormElValue']) . '" />
                        </div>
                        <div id="tree_' . $id . '">
 
index fe922ad..dca684a 100644 (file)
@@ -220,7 +220,7 @@ var TBE_EDITOR = {
                                if (!form) {
                                                // special treatment for IRRE fields:
                                        var tempObj = document[TBE_EDITOR.formname][elementName];
-                                       if (tempObj && Element.hasClassName(tempObj, 'inlineRecord')) {
+                                       if (tempObj && (Element.hasClassName(tempObj, 'inlineRecord') || Element.hasClassName(tempObj, 'treeRecord'))) {
                                                form = tempObj.value ? tempObj.value.split(',') : [];
                                                numberOfElements = form.length;
                                        }