[BUGFIX][!!!] Slider wizard misuses "max" property
authorFrancois Suter <francois@typo3.org>
Thu, 10 Nov 2011 16:19:35 +0000 (17:19 +0100)
committerFrancois Suter <francois@typo3.org>
Fri, 11 Nov 2011 14:42:53 +0000 (15:42 +0100)
TYPO3 4.6 introduced a slider wizard for select-type and
input-type fields. For input-type fields it is possible
to define a minimum and maximum value for the slider.
Unfortunately the wizard misuses the "max" TCA property
for the maximum value, which is normally used for the
"maxlength" attribute of the input field.

The slider wizard should instead rely on the "range" property,
which already exists and serves exactly the purpose of defining
a minimum and maximum value for the field.

Change-Id: I0cf34c78f5109ce244357471a122be0f24f1aeef
Fixes: #31724
Releases: 4.7, 4.6
Reviewed-on: http://review.typo3.org/6618
Reviewed-by: Georg Ringer
Tested-by: Georg Ringer
Reviewed-by: Kay Strobach
Tested-by: Kay Strobach
Reviewed-by: Stefan Neufeind
Reviewed-by: Francois Suter
Tested-by: Francois Suter
t3lib/tceforms/class.t3lib_tceforms_valueslider.php

index c50ac92..f87ce20 100644 (file)
@@ -48,8 +48,14 @@ class t3lib_TCEforms_ValueSlider {
                $field = $params['field'];
                $value = $params['row'][$field];
                $itemName = $params['itemName'];
-               $min = intval($params['fieldConfig']['min']);
-               $max = intval($params['fieldConfig']['max']);
+                       // Set default values (which correspond to those of the JS component)
+               $min = 0;
+               $max = 10000;
+                       // Use the range property, if defined, to set min and max values
+               if (isset($params['fieldConfig']['range'])) {
+                       $min = isset($params['fieldConfig']['range']['lower']) ? intval($params['fieldConfig']['range']['lower']) : 0;
+                       $max = isset($params['fieldConfig']['range']['upper']) ? intval($params['fieldConfig']['range']['upper']) : 10000;
+               }
                $elementType = $params['fieldConfig']['type'];
                $step =  $params['wConf']['step'] ? $params['wConf']['step'] : 1;
                $width = intval($params['wConf']['width']) ? intval($params['wConf']['width']) : 400;