Skip to content

Commit b5d649d

Browse files
author
Florian Eckerstorfer
committed
Merge pull request #401 from benr77/benr77-twig-deprecations-3
Fix `sameas` replacements in Twig
2 parents 699c587 + 364662a commit b5d649d

2 files changed

Lines changed: 17 additions & 17 deletions

File tree

Resources/views/Form/bootstrap.html.twig

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636

3737
{% set type = type|default('text') %}
3838

39-
{% if style == 'inline' and (attr.placeholder is not defined or attr.placeholder is empty) and label is not same(false) %}
39+
{% if style == 'inline' and (attr.placeholder is not defined or attr.placeholder is empty) and label is not same as (false) %}
4040
{% if label is empty %}
4141
{% set attr = attr|merge({ 'placeholder': name|humanize }) %}
4242
{% else %}
@@ -258,7 +258,7 @@
258258
{% endif %}
259259

260260
{%set checkboxdata %}
261-
{% if label is not same(false) %}
261+
{% if label is not same as (false) %}
262262
{% if not compound %}
263263
{% set label_attr = label_attr|merge({'for': id}) %}
264264
{% endif %}
@@ -327,7 +327,7 @@
327327
{% endif %}
328328

329329
{%set radiodata %}
330-
{% if label is not same(false) %}
330+
{% if label is not same as (false) %}
331331
{% if not compound %}
332332
{% set label_attr = label_attr|merge({'for': id}) %}
333333
{% endif %}
@@ -502,7 +502,7 @@
502502

503503
{% block button_widget %}
504504
{% spaceless %}
505-
{% if label is empty and label is not same(false) %}
505+
{% if label is empty and label is not same as (false) %}
506506
{% set label = name|humanize %}
507507
{% endif %}
508508
{% if type is defined and type == 'submit' %}
@@ -559,7 +559,7 @@
559559
{% set col_size = attr.col_size %}
560560
{% endif %}
561561

562-
{% if label is not same(false) %}
562+
{% if label is not same as (false) %}
563563
{% set style = style|default(bootstrap_get_style()) %}
564564
{% set label_col = label_col|default(bootstrap_get_label_col()) %}
565565

@@ -612,7 +612,7 @@
612612
{% endif %}
613613
{% if attr.widget_col is defined and attr.widget_col is not empty %}
614614
{% set widget_col = attr.widget_col %}
615-
{% if label is same(false) and label_col is defined %}
615+
{% if label is same as (false) and label_col is defined %}
616616
{% set widget_col = widget_col + label_col %}
617617
{% endif %}
618618
{% endif %}

Resources/views/Menu/bootstrap.html.twig

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
{% macro attributes(attributes) %}
44
{% for name, value in attributes %}
5-
{%- if value is not none and value is not same(false) -%}
6-
{{- ' %s="%s"'|format(name, value is same(true) ? name|e : value|e)|raw -}}
5+
{%- if value is not none and value is not same as (false) -%}
6+
{{- ' %s="%s"'|format(name, value is same as (true) ? name|e : value|e)|raw -}}
77
{%- endif -%}
88
{%- endfor -%}
99
{% endmacro %}
@@ -29,7 +29,7 @@
2929
{% endblock %}
3030

3131
{% block list %}
32-
{% if item.hasChildren and options.depth is not same(0) and item.displayChildren %}
32+
{% if item.hasChildren and options.depth is not same as (0) and item.displayChildren %}
3333
{% set listAttributes = listAttributes|merge({'class': listAttributes.class|default('')|trim}) %}
3434

3535
{% set listClass = '' %}
@@ -71,7 +71,7 @@
7171

7272
{% block dropdownList %}
7373
{% spaceless %}
74-
{% if item.hasChildren and options.depth is not same(0) and ((item.extras.dropdown is not defined and item.displayChildren is same(true) or item.extras.dropdown is defined and item.extras.dropdown is same(true) and item.displayChildren is same(true))) %}
74+
{% if item.hasChildren and options.depth is not same as (0) and ((item.extras.dropdown is not defined and item.displayChildren is same as (true) or item.extras.dropdown is defined and item.extras.dropdown is same as (true) and item.displayChildren is same as (true))) %}
7575
{% set listAttributes = listAttributes|merge({'class': (listAttributes.class|default('') ~ ' dropdown-menu')|trim}) %}
7676
<ul{{ _self.attributes(listAttributes) }}>
7777
{{ block('children') }}
@@ -82,7 +82,7 @@
8282

8383
{% block listList %}
8484
{% spaceless %}
85-
{% if item.hasChildren and options.depth is not same(0) and item.displayChildren %}
85+
{% if item.hasChildren and options.depth is not same as (0) and item.displayChildren %}
8686
<ul{{ _self.attributes(listAttributes) }}>
8787
{{ block('children') }}
8888
</ul>
@@ -122,15 +122,15 @@
122122
{%- if item.actsLikeLast %}
123123
{%- set classes = classes|merge([options.lastClass]) %}
124124
{%- endif %}
125-
{%- if item.hasChildren and ((options.style is defined and options.style == 'list') or options.currentDepth is not same(1)) %}
125+
{%- if item.hasChildren and ((options.style is defined and options.style == 'list') or options.currentDepth is not same as (1)) %}
126126
{%- set classes = classes|merge(['nav-header']) %}
127-
{%- elseif item.hasChildren and options.style is defined and options.style in ['tabs', 'justified-tabs', 'pills', 'justified-pills', 'navbar', 'navbar-right', 'navbar_justified'] and ((item.extras.dropdown is not defined and item.displayChildren is same(true) or item.extras.dropdown is defined and item.extras.dropdown is same(true) and item.displayChildren is same(true))) %}
127+
{%- elseif item.hasChildren and options.style is defined and options.style in ['tabs', 'justified-tabs', 'pills', 'justified-pills', 'navbar', 'navbar-right', 'navbar_justified'] and ((item.extras.dropdown is not defined and item.displayChildren is same as (true) or item.extras.dropdown is defined and item.extras.dropdown is same as (true) and item.displayChildren is same as (true))) %}
128128
{%- set classes = classes|merge(['dropdown']) %}
129129
{%- endif %}
130130

131131
{%- set attributes = item.attributes %}
132132

133-
{%- if options.style is defined and options.style == 'navbar' and attributes.divider is defined and attributes.divider is not empty and options.currentDepth is same(1) %}
133+
{%- if options.style is defined and options.style == 'navbar' and attributes.divider is defined and attributes.divider is not empty and options.currentDepth is same as (1) %}
134134
{%- set classes = classes|merge(['divider-vertical']) %}
135135
{%- elseif attributes.divider is defined and attributes.divider is not empty %}
136136
{%- set classes = classes|merge(['divider']) %}
@@ -142,9 +142,9 @@
142142
{# displaying the item #}
143143
<li{{ _self.attributes(attributes) }}>
144144
{%- if attributes.divider is defined and attributes.divider is not empty %}
145-
{%- elseif item.hasChildren and options.style is defined and options.style in ['tabs', 'justified-tabs', 'pills', 'justified-pills', 'navbar', 'navbar-right', 'navbar_justified'] and options.currentDepth is same(1) and ((item.extras.dropdown is not defined and item.displayChildren is same(true) or item.extras.dropdown is defined and item.extras.dropdown is same(true) and item.displayChildren is same(true))) %}
145+
{%- elseif item.hasChildren and options.style is defined and options.style in ['tabs', 'justified-tabs', 'pills', 'justified-pills', 'navbar', 'navbar-right', 'navbar_justified'] and options.currentDepth is same as (1) and ((item.extras.dropdown is not defined and item.displayChildren is same as (true) or item.extras.dropdown is defined and item.extras.dropdown is same as (true) and item.displayChildren is same as (true))) %}
146146
{{ block('dropdownElement') }}
147-
{%- elseif item.hasChildren and options.style is defined and options.style in ['tabs', 'justified-tabs', 'pills', 'justified-pills', 'navbar', 'navbar-right', 'navbar_justified'] and options.currentDepth is same(1) and ((item.extras.dropdown is defined and item.extras.dropdown is same(false) or item.displayChildren(false) )) %}
147+
{%- elseif item.hasChildren and options.style is defined and options.style in ['tabs', 'justified-tabs', 'pills', 'justified-pills', 'navbar', 'navbar-right', 'navbar_justified'] and options.currentDepth is same as (1) and ((item.extras.dropdown is defined and item.extras.dropdown is same as (false) or item.displayChildren(false) )) %}
148148
{{ block('linkElement') }}
149149
{%- elseif item.uri is not empty and ((matcher is defined and not matcher.isCurrent(item)) or options.currentAsLink) %}
150150
{{ block('linkElement') }}
@@ -157,7 +157,7 @@
157157
{%- set childrenClasses = item.childrenAttribute('class') is not empty ? [item.childrenAttribute('class')] : [] %}
158158
{%- set childrenClasses = childrenClasses|merge(['menu_level_' ~ item.level]) %}
159159
{%- set listAttributes = item.childrenAttributes|merge({'class': childrenClasses|join(' ') }) %}
160-
{%- if item.hasChildren and options.style is defined and (options.style == 'list' or options.currentDepth is not same(1)) %}
160+
{%- if item.hasChildren and options.style is defined and (options.style == 'list' or options.currentDepth is not same as (1)) %}
161161
{{ block('listList') }}
162162
{%- elseif item.hasChildren and options.style is defined and options.style in ['tabs', 'justified-tabs', 'pills', 'justified-pills', 'navbar', 'navbar-right', 'navbar_justified'] %}
163163
{{ block('dropdownList') }}

0 commit comments

Comments
 (0)