Skip to main content
Post Closed as "Not suitable for this site" by sonfd, Hudri, leymannx, avpaderno
removed tags from the title
Source Link
avpaderno
  • 97.9k
  • 15
  • 164
  • 284

Drupal 9, Twig Tweak, and placing How do I place a Views block with Twig Tweak?

Please forgive the double post -- I posted it in the wrong place the first time.

I've placed a Viewsview block via Twig Tweak in page-front.html.twig before and it worked fine. That was on Drupal 8, but now I'm on Drupal 9. Here'sThis's what I would have done in Drupal 8:.

<div id="library_carousel">{{ drupal_view('library_carousel ', 'block_carousel') }} </div>
<div id="library_carousel">{{ drupal_view('library_carousel ', 'block_carousel') }} </div>

Here'sThis is what I gather I'm supposed to do in Drupal 9:.

<div id="library_carousel">
    <div>{{ drupal_view('library_carousel ', 'block_carousel') }} </div>
</div>
<div id="library_carousel">
    <div>{{ drupal_view('library_carousel ', 'block_carousel') }} </div>
</div>

It's not rendering anything. In Views, it shows the view machine name as 'library_carousel'. Inside the view, it shows the block machine name as 'block_carousel'.

I've confirmed that if I place the block via the Drupal interface, it does render correctly. I just can't get it to render via Twig Tweak. And yes, I've flush all the caches multiple times. Also, I have other things in the page-front twig that render correctly so I know the template is rendering in general.

Any suggestions on why thisWhy isn't working? Thanks!

Drupal 9, Twig Tweak, and placing a Views block

Please forgive the double post -- I posted it in the wrong place the first time.

I've placed a Views block via Twig Tweak in page-front.html.twig before and it worked fine. That was on Drupal 8, but now I'm on Drupal 9. Here's what I would have done in Drupal 8:

<div id="library_carousel">{{ drupal_view('library_carousel ', 'block_carousel') }} </div>

Here's what I gather I'm supposed to do in Drupal 9:

<div id="library_carousel">
    <div>{{ drupal_view('library_carousel ', 'block_carousel') }} </div>
</div>

It's not rendering anything. In Views, it shows the view machine name as 'library_carousel'. Inside the view, it shows the block machine name as 'block_carousel'.

I've confirmed that if I place the block via the Drupal interface, it does render correctly. I just can't get it to render via Twig Tweak. And yes, I've flush all the caches multiple times. Also, I have other things in the page-front twig that render correctly so I know the template is rendering in general.

Any suggestions on why this isn't working? Thanks!

How do I place a block with Twig Tweak?

I've placed a view block via Twig Tweak in page-front.html.twig before and it worked fine. That was on Drupal 8, but now I'm on Drupal 9. This's what I would have done in Drupal 8.

<div id="library_carousel">{{ drupal_view('library_carousel ', 'block_carousel') }} </div>

This is what I gather I'm supposed to do in Drupal 9.

<div id="library_carousel">
    <div>{{ drupal_view('library_carousel ', 'block_carousel') }} </div>
</div>

It's not rendering anything. In Views, it shows the view machine name as 'library_carousel'. Inside the view, it shows the block machine name as 'block_carousel'.

I've confirmed that if I place the block via the Drupal interface, it does render correctly. I just can't get it to render via Twig Tweak. And yes, I've flush all the caches multiple times. Also, I have other things in the page-front twig that render correctly so I know the template is rendering in general.

Why isn't working?

Source Link
Chanel
  • 105
  • 1
  • 12

Drupal 9, Twig Tweak, and placing a Views block

Please forgive the double post -- I posted it in the wrong place the first time.

I've placed a Views block via Twig Tweak in page-front.html.twig before and it worked fine. That was on Drupal 8, but now I'm on Drupal 9. Here's what I would have done in Drupal 8:

<div id="library_carousel">{{ drupal_view('library_carousel ', 'block_carousel') }} </div>

Here's what I gather I'm supposed to do in Drupal 9:

<div id="library_carousel">
    <div>{{ drupal_view('library_carousel ', 'block_carousel') }} </div>
</div>

It's not rendering anything. In Views, it shows the view machine name as 'library_carousel'. Inside the view, it shows the block machine name as 'block_carousel'.

I've confirmed that if I place the block via the Drupal interface, it does render correctly. I just can't get it to render via Twig Tweak. And yes, I've flush all the caches multiple times. Also, I have other things in the page-front twig that render correctly so I know the template is rendering in general.

Any suggestions on why this isn't working? Thanks!