From cd8015f41a82482f177f5f3fe7da19f0292e0f3d Mon Sep 17 00:00:00 2001 From: Johannes Meyer Date: Mon, 1 Sep 2014 14:58:16 +0200 Subject: [PATCH] Pass the current form instance to the callback as second argument refs #5525 --- library/Icinga/Web/Form.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/library/Icinga/Web/Form.php b/library/Icinga/Web/Form.php index 8b0aef091..cae745be5 100644 --- a/library/Icinga/Web/Form.php +++ b/library/Icinga/Web/Form.php @@ -28,7 +28,7 @@ class Form extends Zend_Form /** * The callback to call instead of Form::onSuccess() * - * @var Closure + * @var Callback */ protected $onSuccess; @@ -79,8 +79,8 @@ class Form extends Zend_Form /** * Create a new form * - * Accepts an additional option `onSuccess' which is a - * callback that is called instead of this form's method. + * Accepts an additional option `onSuccess' which is a callback that is called instead of this + * form's method. It is called using the following signature: (Request $request, Form $form). * * @see Zend_Form::__construct() * @@ -457,7 +457,7 @@ class Form extends Zend_Form $this->populate($formData); // Necessary to get isSubmitted() to work if (! $this->getSubmitLabel() || $this->isSubmitted()) { if ($this->isValid($formData) - && (($this->onSuccess !== null && false !== call_user_func($this->onSuccess, $request)) + && (($this->onSuccess !== null && false !== call_user_func($this->onSuccess, $request, $this)) || ($this->onSuccess === null && false !== $this->onSuccess($request)))) { $this->getResponse()->redirectAndExit($this->getRedirectUrl()); }