From 6ba248e110053b068066ad6f1f7baaf7afe965d7 Mon Sep 17 00:00:00 2001 From: Fabian Schmid Date: Fri, 27 Nov 2020 17:32:21 +0100 Subject: [PATCH] [FIX] 0028768: Info-Page (Link) and Permanent Link --- .../Component/MainControls/Renderer.php | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/src/UI/Implementation/Component/MainControls/Renderer.php b/src/UI/Implementation/Component/MainControls/Renderer.php index c1b965540632..9fcb9e3ddd97 100644 --- a/src/UI/Implementation/Component/MainControls/Renderer.php +++ b/src/UI/Implementation/Component/MainControls/Renderer.php @@ -15,6 +15,7 @@ use ILIAS\UI\Implementation\Component\Button\Bulky as IBulky; use ILIAS\UI\Implementation\Component\MainControls\Slate\Slate as ISlate; use ILIAS\UI\Implementation\Render\Template as UITemplateWrapper; +use ILIAS\Data\URI; class Renderer extends AbstractComponentRenderer { @@ -370,10 +371,20 @@ protected function renderFooter(Footer $component, RendererInterface $default_re $tpl->setVariable('TEXT', $component->getText()); $perm_url = $component->getPermanentURL(); - if ($perm_url) { - $url = $perm_url->getBaseURI() . '?' . $perm_url->getQuery(); + if ($perm_url instanceof URI) { + // Since URI::__toString() is only available in ILIAS >= 7 we have to do that on our own... + $uri = $perm_url->getBaseURI(); + $query = $perm_url->getQuery(); + if ($query) { + $uri .= '?' . $query; + } + $fragment = $perm_url->getFragment(); + if ($fragment) { + $uri .= '#' . $fragment; + } + $tpl->setVariable('PERMA_LINK_LABEL', $this->txt('perma_link')); - $tpl->setVariable('PERMANENT_URL', $url); + $tpl->setVariable('PERMANENT_URL', $uri); } return $tpl->get(); }