From cdbd28b25b669c37e753353f2a1f0ac90b4569c4 Mon Sep 17 00:00:00 2001 From: Thomas Gelf Date: Thu, 24 Nov 2016 00:49:09 +0100 Subject: [PATCH] Link: play nice with those different Url objects --- library/Businessprocess/Web/Component/Link.php | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/library/Businessprocess/Web/Component/Link.php b/library/Businessprocess/Web/Component/Link.php index 5f82b59..149c7af 100644 --- a/library/Businessprocess/Web/Component/Link.php +++ b/library/Businessprocess/Web/Component/Link.php @@ -3,6 +3,7 @@ namespace Icinga\Module\Businessprocess\Web\Component; use Icinga\Module\Businessprocess\Web\Url; +use Icinga\Web\Url as WebUrl; class Link extends Component { @@ -31,14 +32,18 @@ class Link extends Component { $link = new static(); $link->text = $text; - if ($url instanceof Url) { + if ($url instanceof WebUrl) { // Hint: Url is also a WebUrl if ($urlParams !== null) { $url->addParams($urlParams); } $link->url = $url; } else { - $link->url = Url::fromPath($url, $urlParams); + if ($urlParams === null) { + $link->url = Url::fromPath($url); + } else { + $link->url = Url::fromPath($url, $urlParams); + } } $link->attributes = new Attributes($attributes);