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