[~FEATURE] Fluid (ViewHelpers): Adjusted AbstractFormViewHelper to be able to namespa...
[Packages/TYPO3.CMS.git] / typo3 / sysext / fluid / Classes / ViewHelpers / Form / TextareaViewHelper.php
1 <?php
2
3 /* *
4 * This script belongs to the FLOW3 package "Fluid". *
5 * *
6 * It is free software; you can redistribute it and/or modify it under *
7 * the terms of the GNU Lesser General Public License as published by the *
8 * Free Software Foundation, either version 3 of the License, or (at your *
9 * option) any later version. *
10 * *
11 * This script is distributed in the hope that it will be useful, but *
12 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHAN- *
13 * TABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser *
14 * General Public License for more details. *
15 * *
16 * You should have received a copy of the GNU Lesser General Public *
17 * License along with the script. *
18 * If not, see http://www.gnu.org/licenses/lgpl.html *
19 * *
20 * The TYPO3 project - inspiring people to share! *
21 * */
22
23 /**
24 * Textarea view helper.
25 * The value of the text area needs to be set via the "value" attribute, as with all other form ViewHelpers.
26 *
27 * = Examples =
28 *
29 * <code title="Example">
30 * <f:textarea name="myTextArea" value="This is shown inside the textarea" />
31 * </code>
32 *
33 * Output:
34 * <textarea name="myTextArea">This is shown inside the textarea</textarea>
35 *
36 * @version $Id: TextareaViewHelper.php 2914 2009-07-28 18:26:38Z bwaidelich $
37 * @license http://www.gnu.org/licenses/lgpl.html GNU Lesser General Public License, version 3 or later
38 * @scope prototype
39 */
40 class Tx_Fluid_ViewHelpers_Form_TextareaViewHelper extends Tx_Fluid_ViewHelpers_Form_AbstractFormFieldViewHelper {
41
42 /**
43 * @var string
44 */
45 protected $tagName = 'textarea';
46
47 /**
48 * Initialize the arguments.
49 *
50 * @return void
51 * @author Sebastian Kurfürst <sebastian@typo3.org>
52 * @api
53 */
54 public function initializeArguments() {
55 parent::initializeArguments();
56 $this->registerTagAttribute('rows', 'int', 'The number of rows of a text area', TRUE);
57 $this->registerTagAttribute('cols', 'int', 'The number of columns of a text area', TRUE);
58 $this->registerTagAttribute('disabled', 'string', 'Specifies that the input element should be disabled when the page loads');
59 $this->registerArgument('errorClass', 'string', 'CSS class to set if there are errors for this view helper', FALSE, 'f3-form-error');
60 $this->registerUniversalTagAttributes();
61 }
62
63 /**
64 * Renders the textarea.
65 *
66 * @return string
67 * @author Sebastian Kurfürst <sebastian@typo3.org>
68 * @author Bastian Waidelich <bastian@typo3.org>
69 * @api
70 */
71 public function render() {
72 $this->tag->forceClosingTag(TRUE);
73 $this->tag->addAttribute('name', $this->getName());
74 $this->tag->setContent($this->getValue());
75
76 $this->setErrorClassAttribute();
77
78 return $this->tag->render();
79 }
80 }
81
82 ?>