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