From 95cbb6198743ffd8f493fb8df38f2723a4a32fee Mon Sep 17 00:00:00 2001 From: Eric Lippmann Date: Thu, 17 Nov 2016 11:18:39 +0100 Subject: [PATCH] Add parameter markAsError to Form::warning() and Form::error() refs #11820 --- library/Icinga/Web/Form.php | 24 ++++++++++++++++-------- 1 file changed, 16 insertions(+), 8 deletions(-) diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php index cfe730984..78d5c6996 100644 --- a/library/Icinga/Web/Form.php +++ b/library/Icinga/Web/Form.php @@ -1576,30 +1576,38 @@ class Form extends Zend_Form } /** - * Add a error notification and prevent the form from being successfully validated + * Add a error notification * - * @param string|array $message The notification message + * @param string|array $message The notification message + * @param bool $markAsError Whether to prevent the form from being successfully validated or not * * @return $this */ - public function error($message) + public function error($message, $markAsError = true) { $this->addNotification($message, self::NOTIFICATION_ERROR); - $this->markAsError(); + if ($markAsError) { + $this->markAsError(); + } + return $this; } /** - * Add a warning notification and prevent the form from being successfully validated + * Add a warning notification * - * @param string|array $message The notification message + * @param string|array $message The notification message + * @param bool $markAsError Whether to prevent the form from being successfully validated or not * * @return $this */ - public function warning($message) + public function warning($message, $markAsError = true) { $this->addNotification($message, self::NOTIFICATION_WARNING); - $this->markAsError(); + if ($markAsError) { + $this->markAsError(); + } + return $this; }