PageRenderTime 46ms CodeModel.GetById 25ms RepoModel.GetById 0ms app.codeStats 0ms

/Nette/Forms/Controls/Button.php

https://github.com/DocX/nette
PHP | 72 lines | 20 code | 16 blank | 36 comment | 0 complexity | d695380c1403863927f48851bcf3fdb6 MD5 | raw file
Possible License(s): BSD-3-Clause
  1. <?php
  2. /**
  3. * Nette Framework
  4. *
  5. * Copyright (c) 2004, 2009 David Grudl (http://davidgrudl.com)
  6. *
  7. * This source file is subject to the "Nette license" that is bundled
  8. * with this package in the file license.txt.
  9. *
  10. * For more information please see http://nettephp.com
  11. *
  12. * @copyright Copyright (c) 2004, 2009 David Grudl
  13. * @license http://nettephp.com/license Nette license
  14. * @link http://nettephp.com
  15. * @category Nette
  16. * @package Nette\Forms
  17. */
  18. /*namespace Nette\Forms;*/
  19. require_once dirname(__FILE__) . '/../../Forms/Controls/FormControl.php';
  20. /**
  21. * Push button control with no default behavior.
  22. *
  23. * @author David Grudl
  24. * @copyright Copyright (c) 2004, 2009 David Grudl
  25. * @package Nette\Forms
  26. */
  27. class Button extends FormControl
  28. {
  29. /**
  30. * @param string caption
  31. */
  32. public function __construct($caption = NULL)
  33. {
  34. parent::__construct($caption);
  35. $this->control->type = 'button';
  36. }
  37. /**
  38. * Bypasses label generation.
  39. * @return void
  40. */
  41. public function getLabel($caption = NULL)
  42. {
  43. return NULL;
  44. }
  45. /**
  46. * Generates control's HTML element.
  47. * @param string
  48. * @return Nette\Web\Html
  49. */
  50. public function getControl($caption = NULL)
  51. {
  52. $control = parent::getControl();
  53. $control->value = $this->translate($caption === NULL ? $this->caption : $caption);
  54. return $control;
  55. }
  56. }