From de169c7bf58ca62285787473b2f60d23de56e5b3 Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Tue, 13 May 2014 14:32:08 +0200 Subject: [PATCH] Make it possible to disable form submit buttons forcefully --- library/Icinga/Web/Form.php | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php index 7cd3ad746..384ca0848 100644 --- a/library/Icinga/Web/Form.php +++ b/library/Icinga/Web/Form.php @@ -127,6 +127,15 @@ class Form extends Zend_Form */ 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 * @@ -279,11 +288,11 @@ class Form extends Zend_Form $this->initCsrfToken(); $this->create(); - if ($this->submitLabel) { + if (!$this->buttonsHidden && $this->submitLabel) { $this->addSubmitButton(); } - if ($this->cancelLabel) { + if (!$this->buttonsHidden && $this->cancelLabel) { $this->addCancelButton(); } @@ -596,4 +605,9 @@ class Form extends Zend_Form return $this; } + + public function hideButtons() + { + $this->buttonsHidden = true; + } }