[BUGFIX] Remove default fieldWizard on NoneElement
[Packages/TYPO3.CMS.git] / typo3 / sysext / backend / Classes / Form / Element / NoneElement.php
1 <?php
2 namespace TYPO3\CMS\Backend\Form\Element;
3
4 /*
5 * This file is part of the TYPO3 CMS project.
6 *
7 * It is free software; you can redistribute it and/or modify it under
8 * the terms of the GNU General Public License, either version 2
9 * of the License, or any later version.
10 *
11 * For the full copyright and license information, please read the
12 * LICENSE.txt file that was distributed with this source code.
13 *
14 * The TYPO3 project - inspiring people to share!
15 */
16
17 use TYPO3\CMS\Core\Utility\MathUtility;
18
19 /**
20 * None element is a "disabled" input element with formatted values if needed.
21 */
22 class NoneElement extends AbstractFormElement
23 {
24 /**
25 * This will render a non-editable display of the content of the field.
26 *
27 * @return string The HTML code for the TCEform field
28 */
29 public function render()
30 {
31 $resultArray = $this->initializeResultArray();
32
33 $parameterArray = $this->data['parameterArray'];
34 $config = $parameterArray['fieldConf']['config'];
35 $itemValue = $parameterArray['itemFormElValue'];
36
37 if (isset($config['format']) && $config['format']) {
38 $formatOptions = $config['format.'] ?? [];
39 $itemValue = $this->formatValue($config['format'], $itemValue, $formatOptions);
40 }
41 if (!$config['pass_content']) {
42 $itemValue = htmlspecialchars($itemValue);
43 }
44
45 $cols = $config['cols'] ?: ($config['size'] ?: $this->defaultInputWidth);
46 $size = MathUtility::forceIntegerInRange($cols ?: $this->defaultInputWidth, 5, $this->maxInputWidth);
47 $width = $this->formMaxWidth($size);
48
49 $fieldInformationResult = $this->renderFieldInformation();
50 $fieldInformationHtml = $fieldInformationResult['html'];
51 $resultArray = $this->mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false);
52
53 $html = [];
54 $html[] = '<div class="formengine-field-item t3js-formengine-field-item">';
55 $html[] = $fieldInformationHtml;
56 $html[] = '<div class="form-wizards-wrap">';
57 $html[] = '<div class="form-wizards-element">';
58 $html[] = '<div class="form-control-wrap" style="max-width: ' . $width . 'px">';
59 $html[] = '<input class="form-control" value="' . htmlspecialchars($itemValue) . '" type="text" disabled>';
60 $html[] = '</div>';
61 $html[] = '</div>';
62 $html[] = '</div>';
63 $html[] = '</div>';
64
65 $resultArray['html'] = implode(LF, $html);
66
67 return $resultArray;
68 }
69 }