Textarea.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. <?php
  2. /**
  3. *
  4. * Cube Framework $Id$ 3fYyHsfxlRttLyjvP5KWfsCJ3uaVxMOzNMi6dTWVz4k=
  5. *
  6. * @link http://codecu.be/framework
  7. * @copyright Copyright (c) 2015 CodeCube SRL
  8. * @license http://codecu.be/framework/license Commercial License
  9. *
  10. * @version 1.5
  11. */
  12. /**
  13. * textarea form element generator class
  14. */
  15. namespace Cube\Form\Element;
  16. use Cube\Form\Element;
  17. class Textarea extends Element
  18. {
  19. /**
  20. *
  21. * type of element - override the variable from the parent class
  22. *
  23. * @var string
  24. */
  25. protected $_element = 'text';
  26. /**
  27. *
  28. * class constructor
  29. *
  30. * @param string $name
  31. */
  32. public function __construct($name)
  33. {
  34. parent::__construct($this->_element, $name);
  35. }
  36. /**
  37. *
  38. * render the form element
  39. *
  40. * @return string
  41. */
  42. public function render()
  43. {
  44. $value = $this->getValue();
  45. $multiple = ($this->getMultiple() === true) ? $this->_brackets : '';
  46. return '<textarea name="' . $this->_name . $multiple . '" '
  47. . $this->renderAttributes() . '>'
  48. . $value
  49. . '</textarea>';
  50. }
  51. }