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