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: */
7:
8: namespace Nette\Forms\Controls;
9:
10: use Nette;
11:
12:
13: /**
14: * Push button control with no default behavior.
15: *
16: * @author David Grudl
17: */
18: class Button extends BaseControl
19: {
20:
21: /**
22: * @param string caption
23: */
24: public function __construct($caption = NULL)
25: {
26: parent::__construct($caption);
27: $this->control->type = 'button';
28: }
29:
30:
31: /**
32: * Bypasses label generation.
33: * @return void
34: */
35: public function getLabel($caption = NULL)
36: {
37: return NULL;
38: }
39:
40:
41: /**
42: * Generates control's HTML element.
43: * @param string
44: * @return Nette\Utils\Html
45: */
46: public function getControl($caption = NULL)
47: {
48: $control = parent::getControl();
49: $control->value = $this->translate($caption === NULL ? $this->caption : $caption);
50: return $control;
51: }
52:
53: }
54: