replaced deprecated Twig sameas test by same as

This commit is contained in:
Fabien Potencier 2015-08-23 09:25:58 +02:00
parent e25aca7072
commit 99a1fcc3e2
4 changed files with 15 additions and 15 deletions

View File

@ -9,7 +9,7 @@
{% block form_label -%} {% block form_label -%}
{% spaceless %} {% spaceless %}
{% if label is sameas(false) %} {% if label is same as(false) %}
<div class="{{ block('form_label_class') }}"></div> <div class="{{ block('form_label_class') }}"></div>
{% else %} {% else %}
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) %} {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ block('form_label_class'))|trim}) %}

View File

@ -166,12 +166,12 @@
{% if parent_label_class is defined %} {% if parent_label_class is defined %}
{% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) %} {% set label_attr = label_attr|merge({class: (label_attr.class|default('') ~ ' ' ~ parent_label_class)|trim}) %}
{% endif %} {% endif %}
{% if label is not sameas(false) and label is empty %} {% if label is not same as(false) and label is empty %}
{% set label = name|humanize %} {% set label = name|humanize %}
{% endif %} {% endif %}
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}> <label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>
{{- widget|raw -}} {{- widget|raw -}}
{{- label is not sameas(false) ? (translation_domain is sameas(false) ? label : label|trans({}, translation_domain)) -}} {{- label is not same as(false) ? (translation_domain is same as(false) ? label : label|trans({}, translation_domain)) -}}
</label> </label>
{% endif %} {% endif %}
{% endblock checkbox_radio_label %} {% endblock checkbox_radio_label %}

View File

@ -74,13 +74,13 @@
{%- block choice_widget_options -%} {%- block choice_widget_options -%}
{% for group_label, choice in options %} {% for group_label, choice in options %}
{%- if choice is iterable -%} {%- if choice is iterable -%}
<optgroup label="{{ choice_translation_domain is sameas(false) ? group_label : group_label|trans({}, choice_translation_domain) }}"> <optgroup label="{{ choice_translation_domain is same as(false) ? group_label : group_label|trans({}, choice_translation_domain) }}">
{% set options = choice %} {% set options = choice %}
{{- block('choice_widget_options') -}} {{- block('choice_widget_options') -}}
</optgroup> </optgroup>
{%- else -%} {%- else -%}
{% set attr = choice.attr %} {% set attr = choice.attr %}
<option value="{{ choice.value }}" {{ block('attributes') }}{% if choice is selectedchoice(value) %} selected="selected"{% endif %}>{{ choice_translation_domain is sameas(false) ? choice.label : choice.label|trans({}, choice_translation_domain) }}</option> <option value="{{ choice.value }}" {{ block('attributes') }}{% if choice is selectedchoice(value) %} selected="selected"{% endif %}>{{ choice_translation_domain is same as(false) ? choice.label : choice.label|trans({}, choice_translation_domain) }}</option>
{%- endif -%} {%- endif -%}
{% endfor %} {% endfor %}
{%- endblock choice_widget_options -%} {%- endblock choice_widget_options -%}
@ -220,7 +220,7 @@
{% set label = name|humanize %} {% set label = name|humanize %}
{%- endif -%} {%- endif -%}
{%- endif -%} {%- endif -%}
<label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>{{ translation_domain is sameas(false) ? label : label|trans({}, translation_domain) }}</label> <label{% for attrname, attrvalue in label_attr %} {{ attrname }}="{{ attrvalue }}"{% endfor %}>{{ translation_domain is same as(false) ? label : label|trans({}, translation_domain) }}</label>
{%- endif -%} {%- endif -%}
{%- endblock form_label -%} {%- endblock form_label -%}
@ -321,9 +321,9 @@
{{- " " -}} {{- " " -}}
{%- if attrname in ['placeholder', 'title'] -%} {%- if attrname in ['placeholder', 'title'] -%}
{{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}" {{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}"
{%- elseif attrvalue is sameas(true) -%} {%- elseif attrvalue is same as(true) -%}
{{- attrname }}="{{ attrname }}" {{- attrname }}="{{ attrname }}"
{%- elseif attrvalue is not sameas(false) -%} {%- elseif attrvalue is not same as(false) -%}
{{- attrname }}="{{ attrvalue }}" {{- attrname }}="{{ attrvalue }}"
{%- endif -%} {%- endif -%}
{%- endfor -%} {%- endfor -%}
@ -335,9 +335,9 @@
{{- " " -}} {{- " " -}}
{%- if attrname in ['placeholder', 'title'] -%} {%- if attrname in ['placeholder', 'title'] -%}
{{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}" {{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}"
{%- elseif attrvalue is sameas(true) -%} {%- elseif attrvalue is same as(true) -%}
{{- attrname }}="{{ attrname }}" {{- attrname }}="{{ attrname }}"
{%- elseif attrvalue is not sameas(false) -%} {%- elseif attrvalue is not same as(false) -%}
{{- attrname }}="{{ attrvalue }}" {{- attrname }}="{{ attrvalue }}"
{%- endif -%} {%- endif -%}
{%- endfor -%} {%- endfor -%}
@ -349,9 +349,9 @@
{{- " " -}} {{- " " -}}
{%- if attrname in ['placeholder', 'title'] -%} {%- if attrname in ['placeholder', 'title'] -%}
{{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}" {{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}"
{%- elseif attrvalue is sameas(true) -%} {%- elseif attrvalue is same as(true) -%}
{{- attrname }}="{{ attrname }}" {{- attrname }}="{{ attrname }}"
{%- elseif attrvalue is not sameas(false) -%} {%- elseif attrvalue is not same as(false) -%}
{{- attrname }}="{{ attrvalue }}" {{- attrname }}="{{ attrvalue }}"
{%- endif -%} {%- endif -%}
{%- endfor -%} {%- endfor -%}
@ -362,9 +362,9 @@
{{- " " -}} {{- " " -}}
{%- if attrname in ['placeholder', 'title'] -%} {%- if attrname in ['placeholder', 'title'] -%}
{{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}" {{- attrname }}="{{ attrvalue|trans({}, translation_domain) }}"
{%- elseif attrvalue is sameas(true) -%} {%- elseif attrvalue is same as(true) -%}
{{- attrname }}="{{ attrname }}" {{- attrname }}="{{ attrname }}"
{%- elseif attrvalue is not sameas(false) -%} {%- elseif attrvalue is not same as(false) -%}
{{- attrname }}="{{ attrvalue }}" {{- attrname }}="{{ attrvalue }}"
{%- endif -%} {%- endif -%}
{%- endfor -%} {%- endfor -%}

View File

@ -610,7 +610,7 @@
<th>{{ option }}</th> <th>{{ option }}</th>
<td><pre>{{ value }}</pre></td> <td><pre>{{ value }}</pre></td>
<td> <td>
{% if data.resolved_options[option] is sameas(value) %} {% if data.resolved_options[option] is same as(value) %}
<em>same as passed value</em> <em>same as passed value</em>
{% else %} {% else %}
<pre>{{ data.resolved_options[option] }}</pre> <pre>{{ data.resolved_options[option] }}</pre>