Commit 2e872f48 authored by Georg Ringer's avatar Georg Ringer Committed by Christian Kuhn
Browse files

[TASK] Improve constant editor

- Skip length check of header
- Use type "number" for integer types
- Apply min & max attributes if available

Resolves: #79421
Releases: master
Change-Id: I508000547214d3d3ca18a8e311ce68dd03dea09b
Reviewed-on: https://review.typo3.org/51386

Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: default avatarTYPO3com <no-reply@typo3.com>
Reviewed-by: Wouter Wolters's avatarWouter Wolters <typo3@wouterwolters.nl>
Reviewed-by: default avatarMattias Nilsson <tollepjaer@gmail.com>
Tested-by: default avatarMattias Nilsson <tollepjaer@gmail.com>
Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
parent e85dfe90
......@@ -1071,6 +1071,8 @@ class ExtendedTemplateService extends TemplateService
} else {
$retArr['params'] = GeneralUtility::intExplode('-', $retArr['paramstr']);
}
$retArr['min'] = $retArr['params'][0];
$retArr['max'] = $retArr['params'][1];
$retArr['paramstr'] = $retArr['params'][0] . ' - ' . $retArr['params'][1];
break;
case 'options':
......@@ -1168,12 +1170,6 @@ class ExtendedTemplateService extends TemplateService
$head = trim($label_parts[0]);
$body = '';
}
if (strlen($head) > 35) {
if (!$body) {
$body = $head;
}
$head = GeneralUtility::fixed_lgd_cs($head, 35);
}
$typeDat = $this->ext_getTypeData($params['type']);
$p_field = '';
$raname = substr(md5($params['name']), 0, 10);
......@@ -1184,17 +1180,26 @@ class ExtendedTemplateService extends TemplateService
switch ($typeDat['type']) {
case 'int':
case 'int+':
$additionalAttributes = '';
if ($typeDat['paramstr']) {
$hint = ' Range: ' . $typeDat['paramstr'];
} elseif ($typeDat['type'] === 'int+') {
$hint = ' Range: 0 - ';
$typeDat['min'] = 0;
} else {
$hint = ' (Integer)';
}
if (isset($typeDat['min'])) {
$additionalAttributes .= ' min="' . (int)$typeDat['min'] . '" ';
}
if (isset($typeDat['max'])) {
$additionalAttributes .= ' max="' . (int)$typeDat['max'] . '" ';
}
$p_field =
'<input class="form-control" id="' . $idName . '" type="text"'
. ' name="' . $fN . '" value="' . $fV . '"' . ' onChange="uFormUrl(' . $aname . ')" />';
'<input class="form-control" id="' . $idName . '" type="number"'
. ' name="' . $fN . '" value="' . $fV . '"' . ' onChange="uFormUrl(' . $aname . ')"' . $additionalAttributes . ' />';
break;
case 'color':
$p_field = '
......@@ -1280,8 +1285,6 @@ class ExtendedTemplateService extends TemplateService
$userFunctionParams = ['fieldName' => $fN, 'fieldValue' => $fV];
$p_field = GeneralUtility::callUserFunction($userFunction, $userFunctionParams, $this);
break;
case 'small':
default:
$p_field = '<input class="form-control" id="' . $idName . '" type="text" name="' . $fN . '" value="' . $fV . '"'
. ' onChange="uFormUrl(' . $aname . ')" />';
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment