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

View File

@ -20,42 +20,6 @@ class DeleteCommentCommandForm extends CommandForm
$this->setAttrib('class', 'inline'); $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} * {@inheritdoc}
*/ */
@ -80,14 +44,59 @@ class DeleteCommentCommandForm extends CommandForm
return $this; 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} * {@inheritdoc}
*/ */
public function onSuccess() public function onSuccess()
{ {
$cmd = new DeleteCommentCommand(); $cmd = new DeleteCommentCommand();
$cmd->setIsService($this->getElement('comment_is_service')->getValue()) $cmd
->setCommentId($this->getElement('comment_id')->getValue()); ->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); $this->getTransport($this->request)->send($cmd);
$redirect = $this->getElement('redirect')->getValue(); $redirect = $this->getElement('redirect')->getValue();
if (! empty($redirect)) { if (! empty($redirect)) {