TYPO3 CMS  TYPO3_6-2
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  parent::initializeArguments();
44  $this->registerTagAttribute('autofocus', 'string', 'Specifies that a text area should automatically get focus when the page loads');
45  $this->registerTagAttribute('rows', 'int', 'The number of rows of a text area');
46  $this->registerTagAttribute('cols', 'int', 'The number of columns of a text area');
47  $this->registerTagAttribute('disabled', 'string', 'Specifies that the input element should be disabled when the page loads');
48  $this->registerTagAttribute('placeholder', 'string', 'The placeholder of the textarea');
49  $this->registerArgument('errorClass', 'string', 'CSS class to set if there are errors for this view helper', FALSE, 'f3-form-error');
51  }
52 
59  public function render() {
60  $name = $this->getName();
62 
63  $this->tag->forceClosingTag(TRUE);
64  $this->tag->addAttribute('name', $name);
65  $this->tag->setContent(htmlspecialchars($this->getValue()));
66 
67  $this->setErrorClassAttribute();
68 
69  return $this->tag->render();
70  }
71 }
registerTagAttribute($name, $type, $description, $required=FALSE, $default=NULL)
registerArgument($name, $type, $description, $required=FALSE, $defaultValue=NULL)