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:
Johannes Meyer 2014-07-24 16:20:01 +02:00
parent c3731fa79e
commit 26a78dc387
1 changed files with 7 additions and 41 deletions

View File

@ -12,57 +12,23 @@ use Icinga\Web\Form;
class ConfirmRemovalForm extends Form
{
/**
* The value of the target to remove
*
* @var string
* Initalize this form
*/
private $removeTarget;
/**
* 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)
public function init()
{
$this->targetName = $name;
$this->removeTarget = $target;
$this->setName('form_confirm_removal');
}
/**
* Create the confirmation form
*
* @see Form::create()
* @see Form::addSubmitButton()
*/
public function create()
public function addSubmitButton()
{
$this->setName('form_confirm_removal');
$this->addElement(
'hidden',
$this->targetName,
array(
'value' => $this->removeTarget,
'required' => true
)
);
$this->addElement(
'button',
'submit',
'btn_submit',
array(
'type' => 'submit',
'escape' => false,
'value' => '1',
'class' => 'btn btn-cta btn-common',
'label' => '<i class="icinga-icon-remove"></i> Confirm Removal'
'label' => t('Confirm Removal')
)
);
}