From 12af2ab140567415734d40286fc789e2446067ec Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jaime=20Pe=CC=81rez=20Crespo?= <jaime.perez@uninett.no> Date: Tue, 14 Feb 2017 16:20:35 +0100 Subject: [PATCH] Make the language parameter name available to the templates, and remove that parameter from the queryParams entry in the template data. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows us to focus on the “real” parameters, ignoring language selection routines. It also allows us to build our own language bar the way we want it, not only with links. --- lib/SimpleSAML/XHTML/Template.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/SimpleSAML/XHTML/Template.php b/lib/SimpleSAML/XHTML/Template.php index f8332794f..65ff74162 100644 --- a/lib/SimpleSAML/XHTML/Template.php +++ b/lib/SimpleSAML/XHTML/Template.php @@ -303,6 +303,7 @@ class SimpleSAML_XHTML_Template */ private function twigDefaultContext() { + $this->data['languageParameterName'] = $this->configuration->getString('language.parameter.name', 'language'); $this->data['localeBackend'] = $this->configuration->getString('language.i18n.backend', 'SimpleSAMLphp'); $this->data['currentLanguage'] = $this->translator->getLanguage()->getLanguage(); // show language bar by default @@ -336,6 +337,9 @@ class SimpleSAML_XHTML_Template // add query parameters, in case we need them in the template $this->data['queryParams'] = $_GET; + if (isset($this->data['queryParams'][$this->data['languageParameterName']])) { + unset($this->data['queryParams'][$this->data['languageParameterName']]); + } } -- GitLab