-
Notifications
You must be signed in to change notification settings - Fork 37
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
10 changed files
with
93 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,7 @@ | |
"authors": [{ | ||
"name": "Svante Richter", | ||
"email": "[email protected]" | ||
},{ | ||
}, { | ||
"name": "Animal Design OG", | ||
"email": "[email protected]" | ||
}], | ||
|
@@ -23,5 +23,8 @@ | |
"psr-4": { | ||
"Bolt\\Extension\\Animal\\Translate\\": ["", "src/"] | ||
} | ||
} | ||
}, | ||
"extra": { | ||
"bolt-assets": "assets" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
0
assets/views/field/_locale.twig → views/field/_locale.twig
100755 → 100644
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
<ul class="localeswitcher"> | ||
{% for iso, locale in locales %} | ||
{% if app.request.get('slug') and app.request.get('_route') == 'contentlink' or app.request.get('_route') == 'pagebinding' %} | ||
{% set newslug = get_slug_from_locale(record, iso) ?: record.slug %} | ||
{% else %} | ||
{% set newslug = app.request.get('slug') %} | ||
{% endif %} | ||
<li {% if locale.slug == app.request.get('_locale') %}class="active"{% endif %}> | ||
<a title="{{ locale.label }}" href="{{ url( | ||
app.request.get('_route'), | ||
app.request.get('_route_params')|merge({_locale: locale.slug, slug: newslug }) | ||
)}}"> | ||
{{ locale.label }} | ||
</a> | ||
{% endfor %} | ||
</ul> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
{%- block choice_widget_collapsed -%} | ||
{%- if required and placeholder is none and not placeholder_in_choices and not multiple and (attr.size is not defined or attr.size <= 1) -%} | ||
{% set required = false %} | ||
{%- endif -%} | ||
<select {{ block('widget_attributes') }}{% if multiple %} multiple="multiple"{% endif %}> | ||
{%- if placeholder is not none -%} | ||
<option value=""{% if required and value is empty %} selected="selected"{% endif %}>{{ placeholder != '' ? (app.request.get('_locale') is null ? placeholder : l(placeholder)) }}</option> | ||
{%- endif -%} | ||
{%- if preferred_choices|length > 0 -%} | ||
{% set options = preferred_choices %} | ||
{{- block('choice_widget_options') -}} | ||
{%- if choices|length > 0 and separator is not none -%} | ||
<option disabled="disabled">{{ separator }}</option> | ||
{%- endif -%} | ||
{%- endif -%} | ||
{%- set options = choices -%} | ||
{{- block('choice_widget_options') -}} | ||
</select> | ||
{%- endblock choice_widget_collapsed -%} | ||
|
||
{%- block choice_widget_options -%} | ||
{% for group_label, choice in options %} | ||
{%- if choice is iterable -%} | ||
<optgroup label="{{ choice_translation_domain is same as(false) ? group_label : group_label|trans({}, choice_translation_domain) }}"> | ||
{% set options = choice %} | ||
{{- block('choice_widget_options') -}} | ||
</optgroup> | ||
{%- else -%} | ||
{% set attr = choice.attr %} | ||
<option value="{{ choice.value }}" {{ block('attributes') }}{% if choice is selectedchoice(value) %} selected="selected"{% endif %}>{{ app.request.get('_locale') is null ? choice.label : l(choice.label) }}</option> | ||
{%- endif -%} | ||
{% endfor %} | ||
{%- endblock choice_widget_options -%} | ||
|
||
{%- block button_widget -%} | ||
{%- if label is empty -%} | ||
{%- if label_format is not empty -%} | ||
{% set label = label_format|replace({ | ||
'%name%': name, | ||
'%id%': id, | ||
}) %} | ||
{%- else -%} | ||
{% set label = name|humanize %} | ||
{%- endif -%} | ||
{%- endif -%} | ||
<button type="{{ type|default('button') }}" {{ block('button_attributes') }}>{{ app.request.get('_locale') is null ? label : l(label) }}</button> | ||
{%- endblock button_widget -%} | ||
|
||
{%- block form_label -%} | ||
{% if label is not same as(false) -%} | ||
{% if not compound -%} | ||
{% set label_attr = label_attr|merge({'for': id}) %} | ||
{%- endif -%} | ||
{% if required -%} | ||
{% set label_attr = label_attr|merge({'class': (label_attr.class|default('') ~ ' required')|trim}) %} | ||
{%- endif -%} | ||
{% if label is empty -%} | ||
{%- if label_format is not empty -%} | ||
{% set label = label_format|replace({ | ||
'%name%': name, | ||
'%id%': id, | ||
}) %} | ||
{%- else -%} | ||
{% set label = name|humanize %} | ||
{%- endif -%} | ||
{%- endif -%} | ||
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>{{ app.request.get('_locale') is null ? label : l(label) }}</label> | ||
{%- endif -%} | ||
{%- endblock form_label -%} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{l(value)}} |