mirror of
https://github.com/Icinga/icingaweb2-module-director.git
synced 2025-07-29 08:44:11 +02:00
QuickForm: dedicated method for special options
This commit is contained in:
parent
3c8f3a7ade
commit
1fc7f6e2cb
@ -66,18 +66,28 @@ abstract class QuickForm extends Zend_Form
|
|||||||
|
|
||||||
public function __construct($options = null)
|
public function __construct($options = null)
|
||||||
{
|
{
|
||||||
if ($options !== null && array_key_exists('icingaModule', $options)) {
|
parent::__construct($this->handleOptions($options));
|
||||||
$this->icingaModule = $options['icingaModule'];
|
|
||||||
$this->icingaModuleName = $this->icingaModule->getName();
|
|
||||||
unset($options['icingaModule']);
|
|
||||||
}
|
|
||||||
parent::__construct($options);
|
|
||||||
$this->setMethod('post');
|
$this->setMethod('post');
|
||||||
$this->setAction(Url::fromRequest());
|
$this->setAction(Url::fromRequest());
|
||||||
$this->createIdElement();
|
$this->createIdElement();
|
||||||
$this->regenerateCsrfToken();
|
$this->regenerateCsrfToken();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function handleOptions($options = null)
|
||||||
|
{
|
||||||
|
if ($options === null) {
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (array_key_exists('icingaModule', $options)) {
|
||||||
|
$this->icingaModule = $options['icingaModule'];
|
||||||
|
$this->icingaModuleName = $this->icingaModule->getName();
|
||||||
|
unset($options['icingaModule']);
|
||||||
|
}
|
||||||
|
|
||||||
|
return $options;
|
||||||
|
}
|
||||||
|
|
||||||
protected function addSubmitButtonIfSet()
|
protected function addSubmitButtonIfSet()
|
||||||
{
|
{
|
||||||
if (false !== ($label = $this->getSubmitLabel())) {
|
if (false !== ($label = $this->getSubmitLabel())) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user