1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (http://nette.org)
5: *
6: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
7: *
8: * For the full copyright and license information, please view
9: * the file license.txt that was distributed with this source code.
10: */
11:
12: namespace Nette\Forms\Controls;
13:
14: use Nette;
15:
16:
17: /**
18: * Multiline text input control.
19: *
20: * @author David Grudl
21: */
22: class TextArea extends TextBase
23: {
24:
25: /**
26: * @param string label
27: * @param int width of the control
28: * @param int height of the control in text lines
29: */
30: public function __construct($label = NULL, $cols = NULL, $rows = NULL)
31: {
32: parent::__construct($label);
33: $this->control->setName('textarea');
34: $this->control->cols = $cols;
35: $this->control->rows = $rows;
36: }
37:
38:
39: /**
40: * Generates control's HTML element.
41: * @return Nette\Utils\Html
42: */
43: public function getControl()
44: {
45: $control = parent::getControl();
46: $control->setText($this->getValue() === '' ? $this->translate($this->emptyValue) : $this->value);
47: return $control;
48: }
49:
50: }
51: