From 8106fe4f79141168a5d07736ab09530c861695fc Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Mon, 6 Oct 2014 10:19:05 +0200 Subject: [PATCH] form: Add `FormElement' as base class for our elements --- library/Icinga/Web/Form/FormElement.php | 62 +++++++++++++++++++++++++ 1 file changed, 62 insertions(+) create mode 100644 library/Icinga/Web/Form/FormElement.php diff --git a/library/Icinga/Web/Form/FormElement.php b/library/Icinga/Web/Form/FormElement.php new file mode 100644 index 000000000..690be1acf --- /dev/null +++ b/library/Icinga/Web/Form/FormElement.php @@ -0,0 +1,62 @@ +_disableLoadDefaultDecorators === true; + } + + /** + * Load default decorators + * + * Icinga Web 2 loads its own default element decorators. For loading Zend's default element decorators set + * FormElement::$_disableLoadDefaultDecorators to false. + * + * @return this + * @see Form::$defaultElementDecorators For Icinga Web 2's default element decorators. + */ + public function loadDefaultDecorators() + { + if ($this->loadDefaultDecoratorsIsDisabled()) { + return $this; + } + + if (! isset($this->_disableLoadDefaultDecorators)) { + $decorators = $this->getDecorators(); + if (empty($decorators)) { + // Load Icinga Web 2's default element decorators + $this->addDecorators(Form::$defaultElementDecorators); + } + } else { + // Load Zend's default decorators + parent::loadDefaultDecorators(); + } + return $this; + } +}