Commit eaaa02f7 authored by Andreas Wolf's avatar Andreas Wolf Committed by Benni Mack
Browse files

[CLEANUP] Remove duplication in FormEngine group element

Change-Id: I3cf50c1ea27a36c86ca019d895da4472e78cdcf4
Releases: master
Resolves: #68774
Reviewed-on: http://review.typo3.org/42294

Reviewed-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Tested-by: Christian Kuhn's avatarChristian Kuhn <lolli@schwarzbu.ch>
Reviewed-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
Tested-by: Benni Mack's avatarBenni Mack <benni@typo3.org>
parent 375b7cb6
......@@ -90,6 +90,20 @@ class GroupElement extends AbstractFormElement {
$html = '<input type="hidden" class="t3js-group-hidden-field" name="' . $parameterArray['itemFormElName'] . '_mul" value="' . ($config['multiple'] ? 1 : 0) . '"' . $disabled . ' />';
// Define parameters for all types below
$commonParameters = array(
'size' => $size,
'dontShowMoveIcons' => isset($config['hideMoveIcons']) || $maxitems <= 1,
'autoSizeMax' => MathUtility::forceIntegerInRange($config['autoSizeMax'], 0),
'maxitems' => $maxitems,
'style' => isset($config['selectedListStyle'])
? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"'
: '',
'readOnly' => $disabled,
'noBrowser' => $noList || isset($config['disable_controls']) && GeneralUtility::inList($config['disable_controls'], 'browser'),
'noList' => $noList,
);
// Acting according to either "file" or "db" type:
switch ((string)$config['internal_type']) {
case 'file_reference':
......@@ -171,22 +185,12 @@ class GroupElement extends AbstractFormElement {
}
}
// Creating the element:
$params = array(
'size' => $size,
$params = array_merge($commonParameters, array(
'allowed' => $allowed,
'disallowed' => $disallowed,
'dontShowMoveIcons' => isset($config['hideMoveIcons']) || $maxitems <= 1,
'autoSizeMax' => MathUtility::forceIntegerInRange($config['autoSizeMax'], 0),
'maxitems' => $maxitems,
'style' => isset($config['selectedListStyle'])
? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"'
: '',
'thumbnails' => $thumbnails,
'readOnly' => $disabled,
'noBrowser' => $noList || isset($config['disable_controls']) && GeneralUtility::inList($config['disable_controls'], 'browser'),
'noList' => $noList,
'noDelete' => $noDelete
);
));
$html .= $this->dbFileIcons(
$parameterArray['itemFormElName'],
'file',
......@@ -225,18 +229,7 @@ class GroupElement extends AbstractFormElement {
// Array of folder items:
$itemArray = GeneralUtility::trimExplode(',', $parameterArray['itemFormElValue'], TRUE);
// Creating the element:
$params = array(
'size' => $size,
'dontShowMoveIcons' => isset($config['hideMoveIcons']) || $maxitems <= 1,
'autoSizeMax' => MathUtility::forceIntegerInRange($config['autoSizeMax'], 0),
'maxitems' => $maxitems,
'style' => isset($config['selectedListStyle'])
? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"'
: '',
'readOnly' => $disabled,
'noBrowser' => $noList || isset($config['disable_controls']) && GeneralUtility::inList($config['disable_controls'], 'browser'),
'noList' => $noList
);
$params = $commonParameters;
$html .= $this->dbFileIcons(
$parameterArray['itemFormElName'],
'folder',
......@@ -293,21 +286,11 @@ class GroupElement extends AbstractFormElement {
}
}
// Creating the element:
$params = array(
'size' => $size,
'dontShowMoveIcons' => isset($config['hideMoveIcons']) || $maxitems <= 1,
'autoSizeMax' => MathUtility::forceIntegerInRange($config['autoSizeMax'], 0),
'maxitems' => $maxitems,
'style' => isset($config['selectedListStyle'])
? ' style="' . htmlspecialchars($config['selectedListStyle']) . '"'
: '',
$params = array_merge($commonParameters, array(
'info' => $info,
'allowedTables' => $allowedTables,
'thumbnails' => $thumbnails,
'readOnly' => $disabled,
'noBrowser' => $noList || isset($config['disable_controls']) && GeneralUtility::inList($config['disable_controls'], 'browser'),
'noList' => $noList
);
));
$html .= $this->dbFileIcons(
$parameterArray['itemFormElName'],
'db',
......
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