1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10: 11:
12:
13:
14:
15: 16: 17: 18: 19: 20:
21: class ImageButton extends SubmitButton
22: {
23:
24: 25: 26: 27:
28: public function __construct($src = NULL, $alt = NULL)
29: {
30: parent::__construct();
31: $this->control->type = 'image';
32: $this->control->src = $src;
33: $this->control->alt = $alt;
34: }
35:
36:
37: 38: 39: 40:
41: public function getHtmlName()
42: {
43: $name = parent::getHtmlName();
44: return strpos($name, '[') === FALSE ? $name : $name . '[]';
45: }
46:
47:
48: 49: 50: 51:
52: public function loadHttpData()
53: {
54: $path = $this->getHtmlName();
55: $path = explode('[', strtr(str_replace(']', '', strpos($path, '[') === FALSE ? $path . '.x' : substr($path, 0, -2)), '.', '_'));
56: $this->setValue(Arrays::get($this->getForm()->getHttpData(), $path, NULL));
57: }
58:
59: }
60: