Add parameter markAsError to Form::warning() and Form::error()

refs 
This commit is contained in:
Eric Lippmann 2016-11-17 11:18:39 +01:00
parent 1be8e14772
commit 95cbb61987
1 changed files with 16 additions and 8 deletions
library/Icinga/Web

View File

@ -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;
}