1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://nette.org)
5: * Copyright (c) 2004 David Grudl (http://davidgrudl.com)
6: * @package Nette\Forms\Controls
7: */
8:
9:
10:
11: /**
12: * Push button control with no default behavior.
13: *
14: * @author David Grudl
15: * @package Nette\Forms\Controls
16: */
17: class Button extends FormControl
18: {
19:
20: /**
21: * @param string caption
22: */
23: public function __construct($caption = NULL)
24: {
25: parent::__construct($caption);
26: $this->control->type = 'button';
27: }
28:
29:
30: /**
31: * Bypasses label generation.
32: * @return void
33: */
34: public function getLabel($caption = NULL)
35: {
36: return NULL;
37: }
38:
39:
40: /**
41: * Generates control's HTML element.
42: * @param string
43: * @return Html
44: */
45: public function getControl($caption = NULL)
46: {
47: $control = parent::getControl();
48: $control->value = $this->translate($caption === NULL ? $this->caption : $caption);
49: return $control;
50: }
51:
52: }
53: