language
Information
- Folder
src/components/template-components/side-nav/language
Files
Schema
$schema: http://json-schema.org/draft-07/schema
$id: /template-components/header/language
type: object
required:
- label
- languages
additionalProperties: false
properties:
label:
type: string
languages:
type: array
items:
type: object
required:
- title
- url
additionalProperties: false
properties:
title:
type: string
url:
type: string
format: uri-reference
is_active:
type: boolean
Mocks
label: Language
languages:
- title: DE
url: url
is_active: true
- title: EN
url: url
- title: FR
url: url
- title: ES
url: url
- title: NL-BE
url: url
Template
{% set content %}
{% set item = {title: "sideNav.language.title"|tc} %}
{% set below = [] %}
{% for language in languages %}
{% if language.is_active %}
{% set item = language %}
{% else %}
{% set below = below|merge([{
title: language.title,
url: language.url,
}]) %}
{% endif %}
{% endfor %}
{% set item = item|merge({below: below}) %}
<div class="SideNavLanguage-nav">
{% include "@template-components/side-nav/_nav/_nav.twig" with {
id: "SideNavLanguage-nav",
items: [item],
label: label,
} only %}
</div>
{% endset %}
<div class="SideNavLanguage js-SideNavLanguage">
{{ content }}
</div>
Variants