Rewrite addForceCreationCheckbox and move it downwards

We should not instantiate form elements directly without any specific
reason.

refs #5525
This commit is contained in:
Johannes Meyer 2014-07-24 08:57:49 +02:00
parent d8b468cf12
commit edf49d091e
1 changed files with 17 additions and 19 deletions

View File

@ -4,32 +4,13 @@
namespace Icinga\Form\Config\Authentication;
use \Zend_Form_Element_Checkbox;
use Icinga\Web\Form;
use Icinga\Web\Form\Decorator\HelpText;
/**
* Base form for authentication backend forms
*/
abstract class BaseBackendForm extends Form
{
/**
* Add checkbox at the beginning of the form which allows to skip logic connection validation
*/
protected function addForceCreationCheckbox()
{
$checkbox = new Zend_Form_Element_Checkbox(
array(
'name' => 'backend_force_creation',
'label' => t('Force Changes'),
'helptext' => t('Check this box to enforce changes without connectivity validation'),
'order' => 0
)
);
$checkbox->addDecorator(new HelpText());
$this->addElement($checkbox);
}
/**
* @see Form::addSubmitButton()
*/
@ -110,4 +91,21 @@ abstract class BaseBackendForm extends Form
$config['name'] = $name;
$this->populate($config);
}
/**
* Add a checkbox to be displayed at the beginning of the form
* which allows the user to skip the connection validation
*/
protected function addForceCreationCheckbox()
{
$this->addElement(
'checkbox',
'force_creation',
array(
'order' => 0,
'label' => t('Force Changes'),
'helptext' => t('Check this box to enforce changes without connectivity validation')
)
);
}
}