Form: Only work with a single type when handling redirect urls
$form->setRedirectUrl('some/url') still works, but $form->getRedirectUrl() will only return instances of Icinga\Web\Url now.
This commit is contained in:
parent
9471c3c574
commit
6c9819204d
|
@ -84,7 +84,7 @@ class Form extends Zend_Form
|
||||||
/**
|
/**
|
||||||
* The url to redirect to upon success
|
* The url to redirect to upon success
|
||||||
*
|
*
|
||||||
* @var string|Url
|
* @var Url
|
||||||
*/
|
*/
|
||||||
protected $redirectUrl;
|
protected $redirectUrl;
|
||||||
|
|
||||||
|
@ -262,9 +262,17 @@ class Form extends Zend_Form
|
||||||
* @param string|Url $url The url to redirect to
|
* @param string|Url $url The url to redirect to
|
||||||
*
|
*
|
||||||
* @return $this
|
* @return $this
|
||||||
|
*
|
||||||
|
* @throws ProgrammingError In case $url is neither a string nor a instance of Icinga\Web\Url
|
||||||
*/
|
*/
|
||||||
public function setRedirectUrl($url)
|
public function setRedirectUrl($url)
|
||||||
{
|
{
|
||||||
|
if (is_string($url)) {
|
||||||
|
$url = Url::fromPath($url, array(), $this->getRequest());
|
||||||
|
} elseif (! $url instanceof Url) {
|
||||||
|
throw new ProgrammingError('$url must be a string or instance of Icinga\Web\Url');
|
||||||
|
}
|
||||||
|
|
||||||
$this->redirectUrl = $url;
|
$this->redirectUrl = $url;
|
||||||
return $this;
|
return $this;
|
||||||
}
|
}
|
||||||
|
@ -272,7 +280,7 @@ class Form extends Zend_Form
|
||||||
/**
|
/**
|
||||||
* Return the url to redirect to upon success
|
* Return the url to redirect to upon success
|
||||||
*
|
*
|
||||||
* @return string|Url
|
* @return Url
|
||||||
*/
|
*/
|
||||||
public function getRedirectUrl()
|
public function getRedirectUrl()
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue