QuickForm: dedicated method for special options

This commit is contained in:
Thomas Gelf 2015-07-30 15:39:09 +02:00
parent 3c8f3a7ade
commit 1fc7f6e2cb
1 changed files with 16 additions and 6 deletions

View File

@ -66,18 +66,28 @@ abstract class QuickForm extends Zend_Form
public function __construct($options = null)
{
if ($options !== null && array_key_exists('icingaModule', $options)) {
$this->icingaModule = $options['icingaModule'];
$this->icingaModuleName = $this->icingaModule->getName();
unset($options['icingaModule']);
}
parent::__construct($options);
parent::__construct($this->handleOptions($options));
$this->setMethod('post');
$this->setAction(Url::fromRequest());
$this->createIdElement();
$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()
{
if (false !== ($label = $this->getSubmitLabel())) {