Source for file Button.php

Documentation is available at Button.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:  * Push button control with no default behavior.
  17. 17:  *
  18. 18:  * @copyright  Copyright (c) 2004, 2010 David Grudl
  19. 19:  * @package    Nette\Forms
  20. 20:  */
  21. 21: class Button extends FormControl
  22. 22: {
  23. 23:  
  24. 24:     /**
  25. 25:      * @param  string  caption
  26. 26:      */
  27. 27:     public function __construct($caption NULL)
  28. 28:     {
  29. 29:         parent::__construct($caption);
  30. 30:         $this->control->type 'button';
  31. 31:     }
  32. 32:  
  33. 33:  
  34. 34:  
  35. 35:     /**
  36. 36:      * Bypasses label generation.
  37. 37:      * @return void 
  38. 38:      */
  39. 39:     public function getLabel($caption NULL)
  40. 40:     {
  41. 41:         return NULL;
  42. 42:     }
  43. 43:  
  44. 44:  
  45. 45:  
  46. 46:     /**
  47. 47:      * Generates control's HTML element.
  48. 48:      * @param  string 
  49. 49:      * @return Html 
  50. 50:      */
  51. 51:     public function getControl($caption NULL)
  52. 52:     {
  53. 53:         $control parent::getControl();
  54. 54:         $control->value $this->translate($caption === NULL $this->caption : $caption);
  55. 55:         return $control;
  56. 56:     }
  57. 57:  
  58. 58: }