1

Block title when using twig-tweak plugin, not showing. I created a block-type view. And using the module's cheat sheets, I called:

{{ drupal_view('views_name', 'block_1') }}
3

You'll have to manually type it on your twig, as per https://www.drupal.org/project/twig_tweak/issues/2738781

If you don't want to type it on twig, a work around would be to add a "Text area" to your view's Header and use replacement patterns, <div class="view-title">[view:title]</div>.


Alternatively, you could ditch Twig Tweak and do it yourself by creating a variable:

function MY_THEME_preprocess_HOOK(&$variables) { 
    // replace HOOK with the template file you're trying to add it to. Ex: node, page, block etc..
    $view  = views_embed_view('view_name', 'block_1');
    $variables["my_view"] = \Drupal::service('renderer')->render($view);
}

Then in the template file you just do {{ my_view }}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.