email.php 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364
  1. <?php
  2. /**
  3. * HTML class for a password type field
  4. *
  5. * @category HTML
  6. * @package HTML_QuickForm
  7. * @author Adam Daniel <adaniel1@eesus.jnj.com>
  8. * @author Bertrand Mansion <bmansion@mamasam.com>
  9. * @version Release: 3.2.11
  10. * @since 1.0
  11. */
  12. class HTML_QuickForm_email extends HTML_QuickForm_input
  13. {
  14. /**
  15. * Class constructor
  16. *
  17. * @param string $elementName (optional)Input field name attribute
  18. * @param string $elementLabel (optional)Input field label
  19. * @param mixed $attributes (optional)Either a typical HTML attribute string
  20. * or an associative array
  21. * @since 1.0
  22. * @access public
  23. * @return void
  24. * @throws
  25. */
  26. public function __construct(
  27. $elementName = null,
  28. $elementLabel = null,
  29. $attributes = null
  30. ) {
  31. if (is_array($attributes) || empty($attributes)) {
  32. $attributes['class'] = 'form-control';
  33. }
  34. parent::__construct($elementName, $elementLabel, $attributes);
  35. $this->setType('email');
  36. }
  37. /**
  38. * Sets size of password element
  39. *
  40. * @param string $size Size of password field
  41. * @since 1.0
  42. * @access public
  43. * @return void
  44. */
  45. function setSize($size)
  46. {
  47. $this->updateAttributes(array('size'=>$size));
  48. }
  49. /**
  50. * Sets maxlength of password element
  51. *
  52. * @param string $maxlength Maximum length of password field
  53. * @since 1.0
  54. * @access public
  55. * @return void
  56. */
  57. function setMaxlength($maxlength)
  58. {
  59. $this->updateAttributes(array('maxlength'=>$maxlength));
  60. }
  61. }