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)
|
||||
{
|
||||
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())) {
|
||||
|
|
Loading…
Reference in New Issue