Form: Register form notifications as custom error messages for API requests
I'd have liked to fix how we transmit validation messages in such cases, but for compatibilty reasons this has to suffice..
This commit is contained in:
parent
96c96df636
commit
ed5ba14df2
|
@ -1580,7 +1580,12 @@ class Form extends Zend_Form
|
|||
*/
|
||||
public function error($message, $markAsError = true)
|
||||
{
|
||||
$this->addNotification($message, self::NOTIFICATION_ERROR);
|
||||
if ($this->getIsApiTarget()) {
|
||||
$this->addErrorMessage($message);
|
||||
} else {
|
||||
$this->addNotification($message, self::NOTIFICATION_ERROR);
|
||||
}
|
||||
|
||||
if ($markAsError) {
|
||||
$this->markAsError();
|
||||
}
|
||||
|
@ -1598,7 +1603,12 @@ class Form extends Zend_Form
|
|||
*/
|
||||
public function warning($message, $markAsError = true)
|
||||
{
|
||||
$this->addNotification($message, self::NOTIFICATION_WARNING);
|
||||
if ($this->getIsApiTarget()) {
|
||||
$this->addErrorMessage($message);
|
||||
} else {
|
||||
$this->addNotification($message, self::NOTIFICATION_WARNING);
|
||||
}
|
||||
|
||||
if ($markAsError) {
|
||||
$this->markAsError();
|
||||
}
|
||||
|
@ -1616,7 +1626,12 @@ class Form extends Zend_Form
|
|||
*/
|
||||
public function info($message, $markAsError = true)
|
||||
{
|
||||
$this->addNotification($message, self::NOTIFICATION_INFO);
|
||||
if ($this->getIsApiTarget()) {
|
||||
$this->addErrorMessage($message);
|
||||
} else {
|
||||
$this->addNotification($message, self::NOTIFICATION_INFO);
|
||||
}
|
||||
|
||||
if ($markAsError) {
|
||||
$this->markAsError();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue