From a39c8c3280e72bd1a309adab5c3336b067e50dda Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Tue, 13 Oct 2015 17:48:16 +0200 Subject: [PATCH] QuickForm: add getSuccessUrl() --- library/Director/Web/Form/QuickForm.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/library/Director/Web/Form/QuickForm.php b/library/Director/Web/Form/QuickForm.php index 8b8d8108..accf083d 100644 --- a/library/Director/Web/Form/QuickForm.php +++ b/library/Director/Web/Form/QuickForm.php @@ -211,6 +211,16 @@ abstract class QuickForm extends Zend_Form return $this; } + public function getSuccessUrl() + { + $url = $this->successUrl ?: $this->getAction(); + if (! $url instanceof Url) { + $url = Url::fromPath($url); + } + + return $url; + } + public function setup() { } @@ -331,7 +341,7 @@ abstract class QuickForm extends Zend_Form public function redirectOnSuccess($message = null) { - $url = $this->successUrl ?: $this->getAction(); + $url = $this->getSuccessUrl(); $this->notifySuccess($this->getSuccessMessage($message)); $this->redirectAndExit($url); }