How to display the number of items in a view with "Twig Tweak"?

by 3cfe5693   Last Updated January 05, 2018 04:07 AM

I just installed the module "Twig Tweak" is it is really excellent. I created a view with two block display. The first block displays my content and the second one displays nothing, just a header with the following code :

<div class="panel-group" id="accordion">
  <div class="panel panel-default">
    <div class="panel-heading">
      <h4 class="panel-title">
        <a data-toggle="collapse" data-parent="#accordion" href="#collapse1">
        <i class="fa fa-object-group fa-lg"></i> Ses contenus (<dd>{{ drupal_view('profil_page_contenu_utilisateur', 'block_1', '@total') }}</dd>)</a>
      </h4>
    </div>
    <div id="collapse1" class="panel-collapse collapse">
      <div class="panel-body"><dd>{{ drupal_view('profil_page_contenu_utilisateur', 'block_1') }}</dd></div>
    </div>
  </div>
</div>

With the following line of code :

<i class="fa fa-object-group fa-lg"></i> Ses contenus (<dd>{{ drupal_view('profil_page_contenu_utilisateur', 'block_1', '@total') }}</dd>)</a>

How to retrieve the element number of a view (block_1) ?

Tags : views 8 theming


Related Questions



Use a custom view for the front page without alias

Updated February 28, 2017 23:07 PM


7-views display filters in other formats

Updated July 24, 2015 14:03 PM