[BUGFIX] Check minitems for TCAtree
authorGeorg Ringer <mail@ringerge.org>
Tue, 3 Jan 2012 14:36:44 +0000 (15:36 +0100)
committerXavier Perseguers <xavier@typo3.org>
Tue, 6 Mar 2012 09:19:51 +0000 (10:19 +0100)
The TCAtree ignores currently the minitems.
This is however e.g. needed to require input for a relation field.

Change-Id: Id972b0e065adf7e0702a8d8f85c469c7fe9ac827
Resolves: #25003
Releases: 4.7, 4.6, 4.5
Reviewed-on: http://review.typo3.org/7661
Reviewed-by: Steffen Ritter
Reviewed-by: Xavier Perseguers
Tested-by: Xavier Perseguers
t3lib/class.t3lib_tceforms.php
t3lib/tceforms/class.t3lib_tceforms_tree.php
typo3/jsfunc.tbe_editor.js

index 177c5dd..7b7c785 100644 (file)
@@ -1439,6 +1439,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 = t3lib_utility_Math::forceIntegerInRange($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 a281351..3a02206 100644 (file)
@@ -213,7 +213,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 f3357bb..ab9ad1a 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;
                                        }