Password.php 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. *
  4. * Cube Framework $Id$ X9fLOT+grjxsYHCr0FoIEkvCAYu2c7/1BgFp+V36X+Y=
  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.4
  11. */
  12. /**
  13. * creates a password element
  14. */
  15. namespace Cube\Form\Element;
  16. use Cube\Form\Element;
  17. class Password extends Element
  18. {
  19. /**
  20. *
  21. * type of element - override the variable from the parent class
  22. *
  23. * @var string
  24. */
  25. protected $_element = 'password';
  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. * renders the password form element
  39. * the element wont render the data resulted from a previous input
  40. *
  41. * @return string the html code of the element
  42. */
  43. public function render()
  44. {
  45. $multiple = ($this->getMultiple() === true) ? $this->_brackets : '';
  46. return $this->getPrefix() . ' '
  47. . '<input type="' . $this->_type . '" '
  48. . 'name="' . $this->_name . $multiple . '" '
  49. . $this->renderAttributes()
  50. . $this->_endTag . ' '
  51. . $this->getSuffix();
  52. }
  53. }