Skip to content

Commit

Permalink
Add defined check for translation_domain property (#7332)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet committed Jul 18, 2021
1 parent 4c8d736 commit a17197b
Show file tree
Hide file tree
Showing 8 changed files with 14 additions and 14 deletions.
Expand Up @@ -20,7 +20,7 @@ file that was distributed with this source code.
data-toggle="tab"
>
<i class="icon-exclamation-sign has-errors hide"></i>
{% if form_group.translation_domain is same as(false) %}
{% if form_group.translation_domain is defined and form_group.translation_domain is same as(false) %}
{{ form_group.label }}
{% else %}
{{ form_group.label|trans({}, form_group.translation_domain ?? associationAdmin.translationDomain) }}
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/views/CRUD/base_edit_form.html.twig
Expand Up @@ -43,7 +43,7 @@
<li{% if (not app.request.query.has('_tab') and loop.index == 1) or (tab_query_index == loop.index) %} class="active"{% endif %}>
<a href="#{{ _tab_name }}" class="changer-tab" aria-controls="{{ _tab_name }}" data-toggle="tab">
<i class="fa fa-exclamation-circle has-errors hide" aria-hidden="true"></i>
{% if form_tab.translation_domain is same as(false) %}
{% if form_tab.translation_domain is defined and form_tab.translation_domain is same as(false) %}
{{ form_tab.label }}
{% else %}
{{ form_tab.label|trans({}, form_tab.translation_domain ?? admin.translationDomain) }}
Expand All @@ -62,7 +62,7 @@
<div class="box-body container-fluid">
<div class="sonata-ba-collapsed-fields">
{% if form_tab.description != false %}
{% if form_tab.translation_domain is same as(false) %}
{% if form_tab.translation_domain is defined and form_tab.translation_domain is same as(false) %}
<p>{{ form_tab.description|raw }}</p>
{% else %}
<p>{{ form_tab.description|trans({}, form_tab.translation_domain ?? admin.translationDomain)|raw }}</p>
Expand Down
6 changes: 3 additions & 3 deletions src/Resources/views/CRUD/base_edit_form_macro.html.twig
Expand Up @@ -8,7 +8,7 @@
<div class="{{ form_group.box_class }}">
<div class="box-header">
<h4 class="box-title">
{% if form_group.translation_domain is same as(false) %}
{% if form_group.translation_domain is defined and form_group.translation_domain is same as(false) %}
{{ form_group.label }}
{% else %}
{{ form_group.label|trans({}, form_group.translation_domain ?? admin.translationDomain) }}
Expand All @@ -18,7 +18,7 @@
<div class="box-body">
<div class="sonata-ba-collapsed-fields">
{% if form_group.description %}
{% if form_group.translation_domain is same as(false) %}
{% if form_group.translation_domain is defined and form_group.translation_domain is same as(false) %}
<p>{{ form_group.description|raw }}</p>
{% else %}
<p>{{ form_group.description|trans({}, form_group.translation_domain ?? admin.translationDomain)|raw }}</p>
Expand All @@ -29,7 +29,7 @@
{{ form_row(form[field_name]) }}
{% else %}
{% if form_group.empty_message != false %}
{% if form_group.empty_message_translation_domain is same as(false) %}
{% if form_group.empty_message_translation_domain is defined and form_group.empty_message_translation_domain is same as(false) %}
<em>{{ form_group.empty_message }}</em>
{% else %}
<em>{{ form_group.empty_message|trans({}, form_group.empty_message_translation_domain ?? admin.translationDomain) }}</em>
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/CRUD/base_list.html.twig
Expand Up @@ -190,7 +190,7 @@ file that was distributed with this source code.
<select name="action" style="width: auto; height: auto" class="form-control">
{% for action, options in batchactions %}
<option value="{{ action }}">
{% if options.translation_domain is same as(false) %}
{% if options.translation_domain is defined and options.translation_domain is same as(false) %}
{{ options.label }}
{% else %}
{{ options.label|trans({}, options.translation_domain ?? admin.translationDomain) }}
Expand Down
4 changes: 2 additions & 2 deletions src/Resources/views/CRUD/base_show.html.twig
Expand Up @@ -48,7 +48,7 @@ file that was distributed with this source code.
{% set _tab_name = tab_prefix ~ '_' ~ loop.index %}
<li{% if (not app.request.query.has('_tab') and loop.index == 1) or (tab_query_index == loop.index) %} class="active"{% endif %}>
<a href="#{{ _tab_name }}" class="changer-tab" aria-controls="{{ _tab_name }}" data-toggle="tab">
{% if show_tab.translation_domain is same as(false) %}
{% if show_tab.translation_domain is defined and show_tab.translation_domain is same as(false) %}
{{ show_tab.label }}
{% else %}
{{ show_tab.label|trans({}, show_tab.translation_domain ?? admin.translationDomain) }}
Expand Down Expand Up @@ -100,7 +100,7 @@ file that was distributed with this source code.
<div class="box-header">
<h4 class="box-title">
{% block show_title %}
{% if show_group.translation_domain is same as(false) %}
{% if show_group.translation_domain is defined and show_group.translation_domain is same as(false) %}
{{ show_group.label }}
{% else %}
{{ show_group.label|trans({}, show_group.translation_domain ?? admin.translationDomain) }}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/CRUD/base_show_macro.html.twig
Expand Up @@ -15,7 +15,7 @@
<div class="box-header">
<h4 class="box-title">
{% block show_title %}
{% if show_group.translation_domain is same as(false) %}
{% if show_group.translation_domain is defined and show_group.translation_domain is same as(false) %}
{{ show_group.label }}
{% else %}
{{ show_group.label|trans({}, show_group.translation_domain ?? admin.translationDomain) }}
Expand Down
2 changes: 1 addition & 1 deletion src/Resources/views/CRUD/dashboard__action.html.twig
@@ -1,6 +1,6 @@
<a class="btn btn-link btn-flat" href="{{ action.url }}">
{{ action.icon|parse_icon }}
{% if action.translation_domain is same as(false) %}
{% if action.translation_domain is defined and action.translation_domain is same as(false) %}
{{ action.label }}
{% else %}
{{ action.label|trans({}, action.translation_domain|default('SonataAdminBundle')) }}
Expand Down
6 changes: 3 additions & 3 deletions src/Resources/views/CRUD/dashboard__action_create.html.twig
@@ -1,7 +1,7 @@
{% if admin.subClasses is empty %}
<a class="btn btn-link btn-flat" href="{{ action.url }}">
{{ action.icon|parse_icon }}
{% if action.translation_domain is same as(false) %}
{% if action.translation_domain is defined and action.translation_domain is same as(false) %}
{{ action.label }}
{% else %}
{{ action.label|trans({}, action.translation_domain|default('SonataAdminBundle')) }}
Expand All @@ -10,7 +10,7 @@
{% else %}
<a class="btn btn-link btn-flat dropdown-toggle" data-toggle="dropdown" href="#">
{{ action.icon|parse_icon }}
{% if action.translation_domain is same as(false) %}
{% if action.translation_domain is defined and action.translation_domain is same as(false) %}
{{ action.label }}
{% else %}
{{ action.label|trans({}, action.translation_domain|default('SonataAdminBundle')) }}
Expand All @@ -21,7 +21,7 @@
{% for subclass in admin.subclasses|keys %}
<li>
<a href="{{ admin.generateUrl('create', {'subclass': subclass}) }}">
{% if action.translation_domain is same as(false) %}
{% if action.translation_domain is defined and action.translation_domain is same as(false) %}
{{ subclass }}
{% else %}
{{ subclass|trans({}, action.translation_domain|default('SonataAdminBundle')) }}
Expand Down

0 comments on commit a17197b

Please sign in to comment.