From 7f1bf6276e8f72a75c5c68993dc3a0865dddf01d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Sergio=20G=C3=B3mez?= <sergio@uco.es>
Date: Sat, 1 Dec 2018 18:49:01 +0100
Subject: [PATCH] Added Module::getModuleURL helper function to resolve urls in
 twig

---
 lib/SimpleSAML/XHTML/Template.php | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php
index 99976cbd4..24f46bbc9 100644
--- a/lib/SimpleSAML/XHTML/Template.php
+++ b/lib/SimpleSAML/XHTML/Template.php
@@ -313,6 +313,9 @@ class Template extends Response
         $twig = new Twig_Environment($loader, $options);
         $twig->addExtension(new Twig_Extensions_Extension_I18n());
 
+        $twig->addFunction(new TwigFunction('moduleURL', [Module::class, 'getModuleURL']));
+
+
         // initialize some basic context
         $langParam = $this->configuration->getString('language.parameter.name', 'language');
         $twig->addGlobal('languageParameterName', $langParam);
-- 
GitLab