I have a TWIG template in Drupal 8. The "dangers" value is incremented according to the result of each view. How to display the TWIG code if the result of "dangers" is not 0
I tested this code {% if dangers > 0 %}
but it doesn't work :
{% set dangers = 0 %}
{% if dangers > 0 %}
Vous avez
{% if drupal_view_result('boutique_page_liste_des_taches_aucun_produit', 'block_1', store_entity.id()) is empty %}
{% set dangers = dangers + 1 %}
{% endif %}
{% if drupal_view_result('boutique_page_liste_des_taches_aucune_variation', 'block_1', store_entity.id()) is not empty %}
{% set dangers = dangers + 1 %}
{% endif %}
{% if drupal_view_result('boutique_page_liste_des_taches_commande', 'block_1', store_entity.id()) is not empty %}
{% set dangers = dangers + 1 %}
{% endif %}
{% if drupal_view_result('boutique_page_liste_des_taches_mode_de_livraison', 'block_1', store_entity.id()) is empty %}
{% set dangers = dangers + 1 %}
{% endif %}
{% if drupal_view_result('boutique_page_liste_des_taches_passerelle_de_paiement', 'block_1', store_entity.id()) is empty %}
{% set dangers = dangers + 1 %}
{% endif %}
{{ dangers }}
tâches importantes à traiter dans votre {{ store_entity.type.entity.label }} "{{ store_entity.name.value }}".
<a href="/store/{{ store_entity.id }}/tasks" data-drupal-link-system-path="/store/{{ store_entity.id }}/tasks">Voir la liste</a>
{% endif %}