Source for file TextArea.php

Documentation is available at TextArea.php

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