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