‪TYPO3CMS  9.5
NoneElement.php
Go to the documentation of this file.
1 <?php
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 
18 
23 {
29  protected ‪$defaultFieldInformation = [
30  'tcaDescription' => [
31  'renderType' => 'tcaDescription',
32  ],
33  ];
34 
40  public function ‪render(): array
41  {
42  $resultArray = $this->‪initializeResultArray();
43 
44  $parameterArray = $this->data['parameterArray'];
45  $config = $parameterArray['fieldConf']['config'];
46  $itemValue = $parameterArray['itemFormElValue'];
47 
48  if (isset($config['format']) && $config['format']) {
49  $formatOptions = $config['format.'] ?? [];
50  $itemValue = $this->‪formatValue($config['format'], $itemValue, $formatOptions);
51  }
52  if (!$config['pass_content']) {
53  $itemValue = htmlspecialchars($itemValue);
54  }
55 
56  $cols = $config['cols'] ?: ($config['size'] ?: ‪$this->defaultInputWidth);
57  $size = ‪MathUtility::forceIntegerInRange($cols ?: $this->defaultInputWidth, 5, $this->maxInputWidth);
58  $width = $this->‪formMaxWidth($size);
59 
60  $fieldInformationResult = $this->‪renderFieldInformation();
61  $fieldInformationHtml = $fieldInformationResult['html'];
62  $resultArray = $this->‪mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false);
63 
64  $html = [];
65  $html[] = '<div class="formengine-field-item t3js-formengine-field-item">';
66  $html[] = $fieldInformationHtml;
67  $html[] = '<div class="form-wizards-wrap">';
68  $html[] = '<div class="form-wizards-element">';
69  $html[] = '<div class="form-control-wrap" style="max-width: ' . $width . 'px">';
70  $html[] = '<input class="form-control" value="' . htmlspecialchars($itemValue) . '" type="text" disabled>';
71  $html[] = '</div>';
72  $html[] = '</div>';
73  $html[] = '</div>';
74  $html[] = '</div>';
75 
76  $resultArray['html'] = implode(LF, $html);
77 
78  return $resultArray;
79  }
80 }
‪TYPO3\CMS\Backend\Form\Element\NoneElement
Definition: NoneElement.php:23
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement\renderFieldInformation
‪array renderFieldInformation()
Definition: AbstractFormElement.php:71
‪TYPO3\CMS\Backend\Form\AbstractNode\mergeChildReturnIntoExistingResult
‪array mergeChildReturnIntoExistingResult(array $existing, array $childReturn, bool $mergeHtml=true)
Definition: AbstractNode.php:115
‪TYPO3\CMS\Backend\Form\AbstractNode\initializeResultArray
‪array initializeResultArray()
Definition: AbstractNode.php:88
‪TYPO3\CMS\Backend\Form\Element\NoneElement\render
‪array render()
Definition: NoneElement.php:39
‪TYPO3\CMS\Core\Utility\MathUtility\forceIntegerInRange
‪static int forceIntegerInRange($theInt, $min, $max=2000000000, $defaultValue=0)
Definition: MathUtility.php:31
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement
Definition: AbstractFormElement.php:31
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement\$defaultInputWidth
‪int $defaultInputWidth
Definition: AbstractFormElement.php:36
‪TYPO3\CMS\Backend\Form\Element
Definition: AbstractFormElement.php:2
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement\formatValue
‪string formatValue($format, $itemValue, $formatOptions=[])
Definition: AbstractFormElement.php:189
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement\formMaxWidth
‪int formMaxWidth($size=48)
Definition: AbstractFormElement.php:297
‪TYPO3\CMS\Core\Utility\MathUtility
Definition: MathUtility.php:21
‪TYPO3\CMS\Backend\Form\Element\NoneElement\$defaultFieldInformation
‪array $defaultFieldInformation
Definition: NoneElement.php:28