Skip to content

Commit 49a0906

Browse files
committed
minor #42010 Improve usage of twig ternary (Seb33300)
This PR was merged into the 4.4 branch. Discussion ---------- Improve usage of twig ternary | Q | A | ------------- | --- | Branch? | 5.4 | Bug fix? | no | New feature? | no | Deprecations? | no | Tickets | none | License | MIT | Doc PR | none Remove useless `else` condition when using twig ternary: > `{{ foo ? 'yes' }}` is the same as `{{ foo ? 'yes' : '' }}` See: https://twig.symfony.com/doc/3.x/templates.html#other-operators Commits ------- 4be962d323 Improve usage of twig ternary
2 parents 73c7de5 + 88e23e1 commit 49a0906

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Resources/views/Collector/security.html.twig

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55
{% block toolbar %}
66
{% if collector.token %}
77
{% set is_authenticated = collector.enabled and collector.authenticated %}
8-
{% set color_code = is_authenticated ? '' : 'yellow' %}
8+
{% set color_code = not is_authenticated ? 'yellow' %}
99
{% else %}
10-
{% set color_code = collector.enabled ? 'red' : '' %}
10+
{% set color_code = collector.enabled ? 'red' %}
1111
{% endif %}
1212

1313
{% set icon %}

0 commit comments

Comments
 (0)