From 59dceb472905cd587f690f9aebdac172810adbff Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Wed, 31 Aug 2016 13:01:57 +0200 Subject: [PATCH] Add name to the delete comment command form refs #11398 --- .../Object/DeleteCommentCommandForm.php | 85 ++++++++++--------- 1 file changed, 47 insertions(+), 38 deletions(-) diff --git a/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php b/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php index e526d60e7..3b1cd5927 100644 --- a/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php +++ b/modules/monitoring/application/forms/Command/Object/DeleteCommentCommandForm.php @@ -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)) {