Add name to the delete comment command form

refs #11398
This commit is contained in:
Eric Lippmann 2016-08-31 13:01:57 +02:00
parent 62f2f92ae8
commit 59dceb4729
1 changed files with 47 additions and 38 deletions

View File

@ -20,42 +20,6 @@ class DeleteCommentCommandForm extends CommandForm
$this->setAttrib('class', 'inline');
}
/**
* {@inheritdoc}
*/
public function createElements(array $formData = array())
{
$this->addElements(
array(
array(
'hidden',
'comment_id',
array(
'required' => true,
'validators' => array('NotEmpty'),
'decorators' => array('ViewHelper')
)
),
array(
'hidden',
'comment_is_service',
array(
'filters' => array('Boolean'),
'decorators' => array('ViewHelper')
)
),
array(
'hidden',
'redirect',
array(
'decorators' => array('ViewHelper')
)
)
)
);
return $this;
}
/**
* {@inheritdoc}
*/
@ -80,14 +44,59 @@ class DeleteCommentCommandForm extends CommandForm
return $this;
}
/**
* {@inheritdoc}
*/
public function createElements(array $formData = array())
{
$this->addElements(
array(
array(
'hidden',
'comment_id',
array(
'required' => true,
'validators' => array('NotEmpty'),
'decorators' => array('ViewHelper')
)
),
array(
'hidden',
'comment_is_service',
array(
'filters' => array('Boolean'),
'decorators' => array('ViewHelper')
)
),
array(
'hidden',
'comment_name',
array(
'decorators' => array('ViewHelper')
)
),
array(
'hidden',
'redirect',
array(
'decorators' => array('ViewHelper')
)
)
)
);
return $this;
}
/**
* {@inheritdoc}
*/
public function onSuccess()
{
$cmd = new DeleteCommentCommand();
$cmd->setIsService($this->getElement('comment_is_service')->getValue())
->setCommentId($this->getElement('comment_id')->getValue());
$cmd
->setCommentId($this->getElement('comment_id')->getValue())
->setCommentName($this->getElement('comment_name')->getValue())
->setIsService($this->getElement('comment_is_service')->getValue());
$this->getTransport($this->request)->send($cmd);
$redirect = $this->getElement('redirect')->getValue();
if (! empty($redirect)) {