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: use Nette;
11:
12:
13: /**
14: * Submittable image button form control.
15: *
16: * @author David Grudl
17: */
18: class ImageButton extends SubmitButton
19: {
20:
21: /**
22: * @param string URI of the image
23: * @param string alternate text for the image
24: */
25: public function __construct($src = NULL, $alt = NULL)
26: {
27: parent::__construct();
28: $this->control->type = 'image';
29: $this->control->src = $src;
30: $this->control->alt = $alt;
31: }
32:
33:
34: /**
35: * Loads HTTP data.
36: * @return void
37: */
38: public function loadHttpData()
39: {
40: parent::loadHttpData();
41: $this->value = $this->value
42: ? array((int) array_shift($this->value), (int) array_shift($this->value))
43: : NULL;
44: }
45:
46:
47: /**
48: * Returns HTML name of control.
49: * @return string
50: */
51: public function getHtmlName()
52: {
53: return parent::getHtmlName() . '[]';
54: }
55:
56: }
57: