Simplify subform usage

refs #5525
This commit is contained in:
Johannes Meyer 2014-09-09 15:00:33 +02:00
parent ceeb3a9ff8
commit e7c021845d
1 changed files with 26 additions and 1 deletions

View File

@ -370,7 +370,7 @@ class Form extends Zend_Form
*/
public function addSubmitButton()
{
if ($this->submitLabel !== null) {
if ($this->submitLabel) {
$this->addElement(
'submit',
'btn_submit',
@ -388,6 +388,31 @@ class Form extends Zend_Form
return $this;
}
/**
* Add a subform
*
* @param Zend_Form $form The subform to add
* @param string $name The name of the subform or null to use the name of $form
* @param int $order The location where to insert the form
*
* @return Zend_Form
*/
public function addSubForm(Zend_Form $form, $name = null, $order = null)
{
if ($form instanceof self) {
$form->removeDecorator('Form');
$form->setSubmitLabel('');
$form->setTokenDisabled();
$form->setUidDisabled();
}
if ($name === null) {
$name = $form->getName();
}
return parent::addSubForm($form, $name, $order);
}
/**
* Create a new element
*