Form: Add property $parent

refs #5600
This commit is contained in:
Johannes Meyer 2015-09-15 16:09:33 +02:00
parent d4c0f10b47
commit d0eb61dc2e

View File

@ -65,6 +65,15 @@ class Form extends Zend_Form
*/ */
protected $created = false; protected $created = false;
/**
* This form's parent
*
* Gets automatically set upon calling addSubForm().
*
* @var Form
*/
protected $parent;
/** /**
* Whether the form is an API target * Whether the form is an API target
* *
@ -243,6 +252,29 @@ class Form extends Zend_Form
parent::__construct($options); 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 * 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->setSubmitLabel('');
$form->setTokenDisabled(); $form->setTokenDisabled();
$form->setUidDisabled(); $form->setUidDisabled();
$form->setParent($this);
} }
if ($name === null) { if ($name === null) {