-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathcontent.html.twig
More file actions
47 lines (42 loc) · 1.91 KB
/
content.html.twig
File metadata and controls
47 lines (42 loc) · 1.91 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
{% extends '@ibexadesign/content/content_view_fields.html.twig' %}
{% block extras %}
{% set current_language = app.request.get('languageCode') ?: content.prioritizedFieldLanguageCode %}
{% if languages|length > 1 %}
<form class="form-inline ibexa-raw-content-title__language-form">
<twig:ibexa:label>{{ 'tab.view.preview'|trans()|desc('Preview') }}</twig:ibexa:label>
{% set choices = languages|map((language) => {
value: path('ibexa.content.translation.view', {
'contentId': location.contentId,
'locationId': location.id,
'languageCode': language.languageCode
}),
label: language.name
}) %}
{% set value = '' %}
{% for language in languages %}
{% if current_language == language.languageCode %}
{% set value = path('ibexa.content.translation.view', {
'contentId': location.contentId,
'locationId': location.id,
'languageCode': language.languageCode
}) %}
{% endif %}
{% endfor %}
{% set source %}
<select class="form-control ibexa-input ibexa-location-language-change">
{% for choice in choices %}
<option value="{{ choice.value }}"
{% if value == choice.value %} selected="selected" {% endif %}
>{{ choice.label }}</option>
{% endfor %}
</select>
{% endset %}
{% include '@ibexadesign/ui/component/dropdown/dropdown.html.twig' with {
source: source,
choices: choices,
value: value,
is_small: true,
} %}
</form>
{% endif %}
{% endblock %}