diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php index 1e42e8ba6..f3a2c8c80 100644 --- a/library/Icinga/Web/Form.php +++ b/library/Icinga/Web/Form.php @@ -65,6 +65,15 @@ class Form extends Zend_Form */ protected $created = false; + /** + * This form's parent + * + * Gets automatically set upon calling addSubForm(). + * + * @var Form + */ + protected $parent; + /** * Whether the form is an API target * @@ -243,6 +252,29 @@ class Form extends Zend_Form parent::__construct($options); } + /** + * Set this form's parent + * + * @param Form $form + * + * @return $this + */ + public function setParent(Form $form) + { + $this->parent = $form; + return $this; + } + + /** + * Return this form's parent + * + * @return Form + */ + public function getParent() + { + return $this->parent; + } + /** * Set a callback that is called instead of this form's onSuccess method * @@ -844,6 +876,7 @@ class Form extends Zend_Form $form->setSubmitLabel(''); $form->setTokenDisabled(); $form->setUidDisabled(); + $form->setParent($this); } if ($name === null) {