‪TYPO3CMS  10.4
TextareaViewHelper.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 
35 {
39  protected ‪$tagName = 'textarea';
40 
44  public function ‪initializeArguments()
45  {
46  parent::initializeArguments();
47  $this->registerTagAttribute('autofocus', 'string', 'Specifies that a text area should automatically get focus when the page loads');
48  $this->registerTagAttribute('rows', 'int', 'The number of rows of a text area');
49  $this->registerTagAttribute('cols', 'int', 'The number of columns of a text area');
50  $this->registerTagAttribute('disabled', 'string', 'Specifies that the input element should be disabled when the page loads');
51  $this->registerTagAttribute('placeholder', 'string', 'The placeholder of the textarea');
52  $this->registerArgument('errorClass', 'string', 'CSS class to set if there are errors for this ViewHelper', false, 'f3-form-error');
53  $this->registerTagAttribute('readonly', 'string', 'The readonly attribute of the textarea', false);
54  $this->registerArgument('required', 'bool', 'Specifies whether the textarea is required', false, false);
55  $this->registerUniversalTagAttributes();
56  }
57 
63  public function ‪render()
64  {
65  $required = $this->arguments['required'] ?? false;
66  $name = $this->‪getName();
69 
70  $this->tag->forceClosingTag(true);
71  $this->tag->addAttribute('name', $name);
72  if ($required === true) {
73  $this->tag->addAttribute('required', 'required');
74  }
75  $this->tag->setContent(htmlspecialchars($this->‪getValueAttribute()));
78 
79  return $this->tag->render();
80  }
81 }
‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper\setErrorClassAttribute
‪setErrorClassAttribute()
Definition: AbstractFormFieldViewHelper.php:331
‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper\setRespectSubmittedDataValue
‪setRespectSubmittedDataValue($respectSubmittedDataValue)
Definition: AbstractFormFieldViewHelper.php:77
‪TYPO3\CMS\Fluid\ViewHelpers\Form\TextareaViewHelper\$tagName
‪string $tagName
Definition: TextareaViewHelper.php:38
‪TYPO3\CMS\Fluid\ViewHelpers\Form
Definition: AbstractFormFieldViewHelper.php:16
‪TYPO3\CMS\Fluid\ViewHelpers\Form\TextareaViewHelper\initializeArguments
‪initializeArguments()
Definition: TextareaViewHelper.php:43
‪TYPO3\CMS\Fluid\ViewHelpers\Form\TextareaViewHelper\render
‪string render()
Definition: TextareaViewHelper.php:62
‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormViewHelper\registerFieldNameForFormTokenGeneration
‪registerFieldNameForFormTokenGeneration($fieldName)
Definition: AbstractFormViewHelper.php:106
‪TYPO3\CMS\Fluid\ViewHelpers\Form\TextareaViewHelper
Definition: TextareaViewHelper.php:35
‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper
Definition: AbstractFormFieldViewHelper.php:30
‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper\addAdditionalIdentityPropertiesIfNeeded
‪addAdditionalIdentityPropertiesIfNeeded()
Definition: AbstractFormFieldViewHelper.php:243
‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper\getName
‪string getName()
Definition: AbstractFormFieldViewHelper.php:90
‪TYPO3\CMS\Fluid\ViewHelpers\Form\AbstractFormFieldViewHelper\getValueAttribute
‪mixed getValueAttribute()
Definition: AbstractFormFieldViewHelper.php:151