| 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 |
declare (strict_types=1); |
| 8 |
namespace Packetery\Nette\Forms\Controls; |
| 9 |
|
| 10 |
/** |
| 11 |
* Submittable image button form control. |
| 12 |
*/ |
| 13 |
class ImageButton extends SubmitButton |
| 14 |
{ |
| 15 |
/** |
| 16 |
* @param string $src URI of the image |
| 17 |
* @param string $alt alternate text for the image |
| 18 |
*/ |
| 19 |
public function __construct(string $src = null, string $alt = null) |
| 20 |
{ |
| 21 |
parent::__construct(); |
| 22 |
$this->control->type = 'image'; |
| 23 |
$this->control->src = $src; |
| 24 |
$this->control->alt = $alt; |
| 25 |
} |
| 26 |
public function loadHttpData() : void |
| 27 |
{ |
| 28 |
parent::loadHttpData(); |
| 29 |
$this->value = $this->value ? [(int) \array_shift($this->value), (int) \array_shift($this->value)] : null; |
| 30 |
} |
| 31 |
public function getHtmlName() : string |
| 32 |
{ |
| 33 |
return parent::getHtmlName() . '[]'; |
| 34 |
} |
| 35 |
} |
| 36 |
|