1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (http://nette.org)
5: *
6: * Copyright (c) 2004, 2011 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
11: */
12:
13:
14:
15: /**
16: * Push button control with no default behavior.
17: *
18: * @author David Grudl
19: */
20: class Button extends FormControl
21: {
22:
23: /**
24: * @param string caption
25: */
26: public function __construct($caption = NULL)
27: {
28: parent::__construct($caption);
29: $this->control->type = 'button';
30: }
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: /**
46: * Generates control's HTML element.
47: * @param string
48: * @return 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:
57: }
58: