‪TYPO3CMS  10.4
NoneElement.php
Go to the documentation of this file.
1 <?php
2 
3 /*
4  * This file is part of the TYPO3 CMS project.
5  *
6  * It is free software; you can redistribute it and/or modify it under
7  * the terms of the GNU General Public License, either version 2
8  * of the License, or any later version.
9  *
10  * For the full copyright and license information, please read the
11  * LICENSE.txt file that was distributed with this source code.
12  *
13  * The TYPO3 project - inspiring people to share!
14  */
15 
17 
19 
24 {
30  protected ‪$defaultFieldInformation = [
31  'tcaDescription' => [
32  'renderType' => 'tcaDescription',
33  ],
34  ];
35 
41  public function ‪render(): array
42  {
43  $resultArray = $this->‪initializeResultArray();
44 
45  $parameterArray = $this->data['parameterArray'];
46  $config = $parameterArray['fieldConf']['config'];
47  $itemValue = $parameterArray['itemFormElValue'];
48 
49  if (isset($config['format']) && $config['format']) {
50  $formatOptions = $config['format.'] ?? [];
51  $itemValue = $this->‪formatValue($config['format'], $itemValue, $formatOptions);
52  }
53  if (!$config['pass_content']) {
54  $itemValue = htmlspecialchars($itemValue);
55  }
56 
57  $cols = $config['cols'] ?: ($config['size'] ?: ‪$this->defaultInputWidth);
58  $size = ‪MathUtility::forceIntegerInRange($cols ?: $this->defaultInputWidth, 5, $this->maxInputWidth);
59  $width = $this->‪formMaxWidth($size);
60 
61  $fieldInformationResult = $this->‪renderFieldInformation();
62  $fieldInformationHtml = $fieldInformationResult['html'];
63  $resultArray = $this->‪mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false);
64 
65  $html = [];
66  $html[] = '<div class="formengine-field-item t3js-formengine-field-item">';
67  $html[] = $fieldInformationHtml;
68  $html[] = '<div class="form-wizards-wrap">';
69  $html[] = '<div class="form-wizards-element">';
70  $html[] = '<div class="form-control-wrap" style="max-width: ' . $width . 'px">';
71  $html[] = '<input class="form-control" value="' . htmlspecialchars($itemValue) . '" type="text" disabled>';
72  $html[] = '</div>';
73  $html[] = '</div>';
74  $html[] = '</div>';
75  $html[] = '</div>';
76 
77  $resultArray['html'] = implode(LF, $html);
78 
79  return $resultArray;
80  }
81 }
‪TYPO3\CMS\Backend\Form\Element\NoneElement
Definition: NoneElement.php:24
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement\renderFieldInformation
‪array renderFieldInformation()
Definition: AbstractFormElement.php:72
‪TYPO3\CMS\Backend\Form\AbstractNode\mergeChildReturnIntoExistingResult
‪array mergeChildReturnIntoExistingResult(array $existing, array $childReturn, bool $mergeHtml=true)
Definition: AbstractNode.php:116
‪TYPO3\CMS\Backend\Form\AbstractNode\initializeResultArray
‪array initializeResultArray()
Definition: AbstractNode.php:90
‪TYPO3\CMS\Backend\Form\Element\NoneElement\render
‪array render()
Definition: NoneElement.php:40
‪TYPO3\CMS\Core\Utility\MathUtility\forceIntegerInRange
‪static int forceIntegerInRange($theInt, $min, $max=2000000000, $defaultValue=0)
Definition: MathUtility.php:32
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement
Definition: AbstractFormElement.php:32
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement\$defaultInputWidth
‪int $defaultInputWidth
Definition: AbstractFormElement.php:37
‪TYPO3\CMS\Backend\Form\Element
Definition: AbstractFormElement.php:16
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement\formatValue
‪string formatValue($format, $itemValue, $formatOptions=[])
Definition: AbstractFormElement.php:190
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement\formMaxWidth
‪int formMaxWidth($size=48)
Definition: AbstractFormElement.php:298
‪TYPO3\CMS\Core\Utility\MathUtility
Definition: MathUtility.php:22
‪TYPO3\CMS\Backend\Form\Element\NoneElement\$defaultFieldInformation
‪array $defaultFieldInformation
Definition: NoneElement.php:29