| 1 |
<?php |
| 2 |
|
| 3 |
namespace ipl\Html\FormElement; |
| 4 |
|
| 5 |
use ipl\Html\Attribute; |
| 6 |
use ipl\Html\Attributes; |
| 7 |
|
| 8 |
class InputElement extends BaseFormElement |
| 9 |
{ |
| 10 |
/** @var string Type of the input */ |
| 11 |
protected $type; |
| 12 |
|
| 13 |
protected $tag = 'input'; |
| 14 |
|
| 15 |
/** |
| 16 |
* Get the type of the input |
| 17 |
* |
| 18 |
* @return string |
| 19 |
*/ |
| 20 |
public function getType() |
| 21 |
{ |
| 22 |
return $this->type; |
| 23 |
} |
| 24 |
|
| 25 |
/** |
| 26 |
* Set the type of the input |
| 27 |
* |
| 28 |
* @param string $type |
| 29 |
* |
| 30 |
* @return $this |
| 31 |
*/ |
| 32 |
public function setType($type) |
| 33 |
{ |
| 34 |
$this->type = (string) $type; |
| 35 |
|
| 36 |
return $this; |
| 37 |
} |
| 38 |
|
| 39 |
protected function registerAttributeCallbacks(Attributes $attributes) |
| 40 |
{ |
| 41 |
parent::registerAttributeCallbacks($attributes); |
| 42 |
|
| 43 |
$attributes->registerAttributeCallback( |
| 44 |
'type', |
| 45 |
[$this, 'getType'], |
| 46 |
[$this, 'setType'] |
| 47 |
); |
| 48 |
} |
| 49 |
} |