mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-24 06:14:25 +02:00
Rewrite addForceCreationCheckbox and move it downwards
We should not instantiate form elements directly without any specific reason. refs #5525
This commit is contained in:
parent
d8b468cf12
commit
edf49d091e
@ -4,32 +4,13 @@
|
|||||||
|
|
||||||
namespace Icinga\Form\Config\Authentication;
|
namespace Icinga\Form\Config\Authentication;
|
||||||
|
|
||||||
use \Zend_Form_Element_Checkbox;
|
|
||||||
use Icinga\Web\Form;
|
use Icinga\Web\Form;
|
||||||
use Icinga\Web\Form\Decorator\HelpText;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Base form for authentication backend forms
|
* Base form for authentication backend forms
|
||||||
*/
|
*/
|
||||||
abstract class BaseBackendForm extends Form
|
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()
|
* @see Form::addSubmitButton()
|
||||||
*/
|
*/
|
||||||
@ -110,4 +91,21 @@ abstract class BaseBackendForm extends Form
|
|||||||
$config['name'] = $name;
|
$config['name'] = $name;
|
||||||
$this->populate($config);
|
$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')
|
||||||
|
)
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user