Make it possible to disable form submit buttons forcefully

This commit is contained in:
Johannes Meyer 2014-05-13 14:32:08 +02:00
parent 88e451402f
commit de169c7bf5
1 changed files with 16 additions and 2 deletions

View File

@ -127,6 +127,15 @@ class Form extends Zend_Form
*/ */
protected $last_note_id = 0; protected $last_note_id = 0;
/**
* Whether buttons are shown or not
*
* This is just a q&d solution and MUST NOT survive any refactoring!
*
* @var bool
*/
protected $buttonsHidden = false;
/** /**
* Getter for the session ID * Getter for the session ID
* *
@ -279,11 +288,11 @@ class Form extends Zend_Form
$this->initCsrfToken(); $this->initCsrfToken();
$this->create(); $this->create();
if ($this->submitLabel) { if (!$this->buttonsHidden && $this->submitLabel) {
$this->addSubmitButton(); $this->addSubmitButton();
} }
if ($this->cancelLabel) { if (!$this->buttonsHidden && $this->cancelLabel) {
$this->addCancelButton(); $this->addCancelButton();
} }
@ -596,4 +605,9 @@ class Form extends Zend_Form
return $this; return $this;
} }
public function hideButtons()
{
$this->buttonsHidden = true;
}
} }