Skip to content
Snippets Groups Projects
Commit 09c1c97e authored by Jaime Pérez Crespo's avatar Jaime Pérez Crespo
Browse files

Populate the query parameters in the twig context.

This allows us to build the language switching links even when we have query parameters that would otherwise get lost.
parent b23bb374
No related branches found
No related tags found
No related merge requests found
......@@ -333,6 +333,9 @@ class SimpleSAML_XHTML_Template
if ($this->translator->getLanguage()->isLanguageRTL()) {
$this->data['isRTL'] = true;
}
// add query parameters, in case we need them in the template
$this->data['queryParams'] = $_GET;
}
......
......@@ -5,10 +5,18 @@
{% if not hideLanguageBar %}
<div id="languagebar">
{% for lang in languageBar %}
{%- if not loop.first -%} | {% endif -%}{% if lang.url %}<a href="{{ lang.url }}">{{ lang.name }}</a>{% else %}{{ lang.name }}{% endif %}
{%- if not loop.first -%}|{% endif -%}
{% if lang.url %}
<a href="{{ lang.url -}}
{%- if queryParams %}&{% endif -%}
{%- for name, value in queryParams -%}
{%- if not loop.first %}&{% endif -%}
{%- if value %}{{ name }}={{ value }}{% else %}{{ name }}{% endif -%}
{%- endfor %}">{{ lang.name }}</a>
{% else %}
{{ lang.name }}
{% endif %}
{% endfor %}
</div>
{% endif %}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment