-
Notifications
You must be signed in to change notification settings - Fork 138
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1afb2b9
commit 4a5f7c3
Showing
2 changed files
with
72 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
{% block a2lix_translations_widget %} | ||
{{ form_errors(form) }} | ||
|
||
<div class="a2lix_translations"> | ||
<ul class="a2lix_translationsLocales nav nav-tabs" role="tablist"> | ||
{% for translationsFields in form %} | ||
{% set locale = translationsFields.vars.name %} | ||
|
||
<li{% if app.request.locale == locale %} class="active"{% endif %}> | ||
<a href="#{{ translationsFields.vars.id }}_a2lix_translations-fields" data-toggle="tab" role="tab"> | ||
{{ translationsFields.vars.label|default(locale|humanize)|trans }} | ||
{% if form.vars.default_locale == locale %}{{ '[Default]'|trans }}{% endif %} | ||
{% if translationsFields.vars.required %}*{% endif %} | ||
</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
|
||
<div class="a2lix_translationsFields tab-content"> | ||
{% for translationsFields in form %} | ||
{% set locale = translationsFields.vars.name %} | ||
|
||
<div id="{{ translationsFields.vars.id }}_a2lix_translations-fields" class="tab-pane {% if app.request.locale == locale %}active{% endif %} {% if not form.vars.valid %}sonata-ba-field-error{% endif %}" role="tabpanel"> | ||
{{ form_errors(translationsFields) }} | ||
{{ form_widget(translationsFields) }} | ||
</div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
{% endblock %} | ||
|
||
{% block a2lix_translationsForms_widget %} | ||
{{ block('a2lix_translations_widget') }} | ||
{% endblock %} |
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,38 @@ | ||
{# | ||
Example: | ||
{% import "@A2lixTranslationForm/macros_bootstrap_3.html.twig" as a2lixTranslations %} | ||
{{ a2lixTranslations.partialTranslations(editForm.translations, ['title','description']) }} | ||
{{ a2lixTranslations.partialTranslations(editForm.translations, ['url']) }} | ||
#} | ||
|
||
{% macro partialTranslations(form, fieldsNames) %} | ||
{{ form_errors(form) }} | ||
|
||
<div class="a2lix_translations"> | ||
<ul class="a2lix_translationsLocales nav nav-tabs" role="tablist"> | ||
{% for translationsFields in form %} | ||
{% set locale = translationsFields.vars.name %} | ||
|
||
<li{% if app.request.locale == locale %} class="active"{% endif %}> | ||
<a href="#{{ translationsFields.vars.id }}_a2lix_translations-fields" data-toggle="tab" role="tab"> | ||
{{ translationsFields.vars.label|default(locale|humanize)|trans }} | ||
{% if form.vars.default_locale == locale %}{{ '[Default]'|trans }}{% endif %} | ||
{% if translationsFields.vars.required %}*{% endif %} | ||
</a> | ||
</li> | ||
{% endfor %} | ||
</ul> | ||
|
||
<div class="a2lix_translationsFields tab-content"> | ||
{% for translationsFields in form %} | ||
{% set locale = translationsFields.vars.name %} | ||
|
||
<div id="{{ translationsFields.vars.id }}_a2lix_translations-fields" class="tab-pane {% if app.request.locale == locale %}active{% endif %} {% if not form.vars.valid %}sonata-ba-field-error{% endif %}" role="tabpanel"> | ||
{% for translationsField in translationsFields|filter(translationsField => translationsField.vars.name in fieldsNames) %} | ||
{{ form_row(translationsField) }} | ||
{% endfor %} | ||
</div> | ||
{% endfor %} | ||
</div> | ||
</div> | ||
{% endmacro %} |