1: <?php
2:
3: /**
4: * This file is part of the Nette Framework.
5: *
6: * Copyright (c) 2004, 2010 David Grudl (http://davidgrudl.com)
7: *
8: * This source file is subject to the "Nette license", and/or
9: * GPL license. For more information please see http://nette.org
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 NButton extends NFormControl
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 NHtml
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: