1: <?php
2:
3: /**
4: * This file is part of the Nette Framework (https://nette.org)
5: * Copyright (c) 2004 David Grudl (https://davidgrudl.com)
6: */
7:
8: namespace Nette\Forms\Controls;
9:
10:
11: /**
12: * Submittable image button form control.
13: *
14: * @author David Grudl
15: */
16: class ImageButton extends SubmitButton
17: {
18:
19: /**
20: * @param string URI of the image
21: * @param string alternate text for the image
22: */
23: public function __construct($src = NULL, $alt = NULL)
24: {
25: parent::__construct();
26: $this->control->type = 'image';
27: $this->control->src = $src;
28: $this->control->alt = $alt;
29: }
30:
31:
32: /**
33: * Loads HTTP data.
34: * @return void
35: */
36: public function loadHttpData()
37: {
38: parent::loadHttpData();
39: $this->value = $this->value
40: ? array((int) array_shift($this->value), (int) array_shift($this->value))
41: : NULL;
42: }
43:
44:
45: /**
46: * Returns HTML name of control.
47: * @return string
48: */
49: public function getHtmlName()
50: {
51: return parent::getHtmlName() . '[]';
52: }
53:
54: }
55: