‪TYPO3CMS  ‪main
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 
20 
25 {
29  protected ‪$minimumInputWidth = 5;
30 
36  protected ‪$defaultFieldInformation = [
37  'tcaDescription' => [
38  'renderType' => 'tcaDescription',
39  ],
40  ];
41 
47  public function ‪render(): array
48  {
49  $resultArray = $this->‪initializeResultArray();
50 
51  $parameterArray = $this->data['parameterArray'];
52  $config = $parameterArray['fieldConf']['config'];
53  $itemValue = $parameterArray['itemFormElValue'];
54 
55  if ($config['format'] ?? false) {
56  $formatOptions = $config['format.'] ?? [];
57  $itemValue = $this->‪formatValue($config['format'], $itemValue, $formatOptions);
58  }
59 
60  $size = $config['size'] ?? ‪$this->defaultInputWidth;
61  $size = ‪MathUtility::forceIntegerInRange($size, $this->minimumInputWidth, $this->maxInputWidth);
62  $width = $this->‪formMaxWidth($size);
63  $fieldId = ‪StringUtility::getUniqueId('formengine-textarea-');
64 
65  $fieldInformationResult = $this->‪renderFieldInformation();
66  $fieldInformationHtml = $fieldInformationResult['html'];
67  $resultArray = $this->‪mergeChildReturnIntoExistingResult($resultArray, $fieldInformationResult, false);
68 
69  $html = [];
70  $html[] = $this->‪renderLabel($fieldId);
71  $html[] = '<div class="formengine-field-item t3js-formengine-field-item">';
72  $html[] = $fieldInformationHtml;
73  $html[] = '<div class="form-wizards-wrap">';
74  $html[] = '<div class="form-wizards-element">';
75  $html[] = '<div class="form-control-wrap" style="max-width: ' . $width . 'px">';
76  $html[] = '<input class="form-control" id="' . htmlspecialchars($fieldId) . '" value="' . htmlspecialchars($itemValue) . '" type="text" disabled>';
77  $html[] = '</div>';
78  $html[] = '</div>';
79  $html[] = '</div>';
80  $html[] = '</div>';
81 
82  $resultArray['html'] = implode(LF, $html);
83 
84  return $resultArray;
85  }
86 }
‪TYPO3\CMS\Backend\Form\Element\NoneElement
Definition: NoneElement.php:25
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement\renderFieldInformation
‪array renderFieldInformation()
Definition: AbstractFormElement.php:73
‪TYPO3\CMS\Backend\Form\AbstractNode\mergeChildReturnIntoExistingResult
‪array mergeChildReturnIntoExistingResult(array $existing, array $childReturn, bool $mergeHtml=true)
Definition: AbstractNode.php:104
‪TYPO3\CMS\Backend\Form\Element\NoneElement\render
‪array render()
Definition: NoneElement.php:45
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement
Definition: AbstractFormElement.php:37
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement\$defaultInputWidth
‪int $defaultInputWidth
Definition: AbstractFormElement.php:43
‪TYPO3\CMS\Backend\Form\Element
Definition: AbstractFormElement.php:16
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement\formatValue
‪string formatValue($format, $itemValue, $formatOptions=[])
Definition: AbstractFormElement.php:217
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement\formMaxWidth
‪int formMaxWidth($size=48)
Definition: AbstractFormElement.php:332
‪TYPO3\CMS\Backend\Form\Element\NoneElement\$minimumInputWidth
‪int $minimumInputWidth
Definition: NoneElement.php:28
‪TYPO3\CMS\Backend\Form\Element\AbstractFormElement\renderLabel
‪renderLabel(string $for)
Definition: AbstractFormElement.php:119
‪TYPO3\CMS\Core\Utility\MathUtility
Definition: MathUtility.php:24
‪TYPO3\CMS\Core\Utility\MathUtility\forceIntegerInRange
‪static int forceIntegerInRange(mixed $theInt, int $min, int $max=2000000000, int $defaultValue=0)
Definition: MathUtility.php:34
‪TYPO3\CMS\Core\Utility\StringUtility
Definition: StringUtility.php:24
‪TYPO3\CMS\Core\Utility\StringUtility\getUniqueId
‪static getUniqueId(string $prefix='')
Definition: StringUtility.php:57
‪TYPO3\CMS\Backend\Form\Element\NoneElement\$defaultFieldInformation
‪array $defaultFieldInformation
Definition: NoneElement.php:34
‪TYPO3\CMS\Backend\Form\AbstractNode\initializeResultArray
‪initializeResultArray()
Definition: AbstractNode.php:77