TYPO3 CMS  TYPO3_7-6
TextareaViewHelper.php
Go to the documentation of this file.
1 <?php
3 
4 /* *
5  * This script is backported from the TYPO3 Flow package "TYPO3.Fluid". *
6  * *
7  * It is free software; you can redistribute it and/or modify it under *
8  * the terms of the GNU Lesser General Public License, either version 3 *
9  * of the License, or (at your option) any later version. *
10  * *
11  * The TYPO3 project - inspiring people to share! *
12  * */
13 
30 {
34  protected $tagName = 'textarea';
35 
42  public function initializeArguments()
43  {
44  parent::initializeArguments();
45  $this->registerTagAttribute('autofocus', 'string', 'Specifies that a text area should automatically get focus when the page loads');
46  $this->registerTagAttribute('rows', 'int', 'The number of rows of a text area');
47  $this->registerTagAttribute('cols', 'int', 'The number of columns of a text area');
48  $this->registerTagAttribute('disabled', 'string', 'Specifies that the input element should be disabled when the page loads');
49  $this->registerTagAttribute('placeholder', 'string', 'The placeholder of the textarea');
50  $this->registerArgument('errorClass', 'string', 'CSS class to set if there are errors for this view helper', false, 'f3-form-error');
52  }
53 
60  public function render()
61  {
62  $name = $this->getName();
64  $this->setRespectSubmittedDataValue(true);
65 
66  $this->tag->forceClosingTag(true);
67  $this->tag->addAttribute('name', $name);
68  $this->tag->setContent(htmlspecialchars($this->getValueAttribute()));
69 
71  $this->setErrorClassAttribute();
72 
73  return $this->tag->render();
74  }
75 }
registerArgument($name, $type, $description, $required=false, $defaultValue=null)
registerTagAttribute($name, $type, $description, $required=false, $default=null)