How to create a counter with TWIG?
问题 I have a site with Drupal 8 and I want to create a task counter with TWIG. I use views with conditions. The counter must be incremented whether the view has a result or not. Here is the code I just made : <span class="badge badge-warning task-badge-warning"> {% if drupal_view_result('boutique_page_liste_des_taches_produit_non_publie', 'block_1') is not empty %} 1 {% endif %} {% if drupal_view_result('boutique_page_liste_des_taches_role_marchand', 'block_1') is empty %} 1 {% endif %} </span>