mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-27 15:54:03 +02:00
BaseFormElement: move attribute callbacks to...
...dedicated methods, this allows to override them
This commit is contained in:
parent
e7fc4d3009
commit
5e19d3bada
@ -41,10 +41,18 @@ abstract class BaseFormElement extends BaseHtmlElement
|
||||
/**
|
||||
* Link constructor.
|
||||
* @param $name
|
||||
* @param $value
|
||||
* @param \dipl\Html\Attributes|array|null $attributes
|
||||
*/
|
||||
public function __construct($name, $attributes = null)
|
||||
{
|
||||
$this->registerAttributeCallbacks();
|
||||
if ($attributes !== null) {
|
||||
$this->addAttributes($attributes);
|
||||
}
|
||||
$this->setName($name);
|
||||
}
|
||||
|
||||
protected function registerAttributeCallbacks()
|
||||
{
|
||||
$this->getAttributes()
|
||||
->registerAttributeCallback('label', [$this, 'getNoAttribute'], [$this, 'setLabel'])
|
||||
@ -53,10 +61,6 @@ abstract class BaseFormElement extends BaseHtmlElement
|
||||
->registerAttributeCallback('description', [$this, 'getNoAttribute'], [$this, 'setDescription'])
|
||||
->registerAttributeCallback('validators', null, [$this, 'setValidators'])
|
||||
->registerAttributeCallback('required', [$this, 'getRequiredAttribute'], [$this, 'setRequired']);
|
||||
if ($attributes !== null) {
|
||||
$this->addAttributes($attributes);
|
||||
}
|
||||
$this->setName($name);
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user