mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-07-28 08:14:03 +02:00
Remove properties from ConfirmRemovalForm and update it
Which object should be removed needs not to be a part of a form but is accessible from the url's query string which should be in the action of the form. refs #5525
This commit is contained in:
parent
c3731fa79e
commit
26a78dc387
@ -12,57 +12,23 @@ use Icinga\Web\Form;
|
|||||||
class ConfirmRemovalForm extends Form
|
class ConfirmRemovalForm extends Form
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
* The value of the target to remove
|
* Initalize this form
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
*/
|
||||||
private $removeTarget;
|
public function init()
|
||||||
|
|
||||||
/**
|
|
||||||
* The name of the target parameter to remove
|
|
||||||
*
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
private $targetName;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Set the remove target in this field to be a hidden field with $name and value $target
|
|
||||||
*
|
|
||||||
* @param string $name The name to be set in the hidden field
|
|
||||||
* @param string $target The value to be set in the hidden field
|
|
||||||
*/
|
|
||||||
public function setRemoveTarget($name, $target)
|
|
||||||
{
|
{
|
||||||
$this->targetName = $name;
|
$this->setName('form_confirm_removal');
|
||||||
$this->removeTarget = $target;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create the confirmation form
|
* @see Form::addSubmitButton()
|
||||||
*
|
|
||||||
* @see Form::create()
|
|
||||||
*/
|
*/
|
||||||
public function create()
|
public function addSubmitButton()
|
||||||
{
|
{
|
||||||
$this->setName('form_confirm_removal');
|
|
||||||
$this->addElement(
|
$this->addElement(
|
||||||
'hidden',
|
'submit',
|
||||||
$this->targetName,
|
|
||||||
array(
|
|
||||||
'value' => $this->removeTarget,
|
|
||||||
'required' => true
|
|
||||||
)
|
|
||||||
);
|
|
||||||
|
|
||||||
$this->addElement(
|
|
||||||
'button',
|
|
||||||
'btn_submit',
|
'btn_submit',
|
||||||
array(
|
array(
|
||||||
'type' => 'submit',
|
'label' => t('Confirm Removal')
|
||||||
'escape' => false,
|
|
||||||
'value' => '1',
|
|
||||||
'class' => 'btn btn-cta btn-common',
|
|
||||||
'label' => '<i class="icinga-icon-remove"></i> Confirm Removal'
|
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user