简体   繁体   中英

Drupal 8 - Getting dynamic content with view data into a page/template

I'm new to Drupal and Drupal 8 and I want to add areas(blocks?) that I can easily add to a page that pulls in and has access to selected view data and fields. What's the easiest way to get this done? It seems like it should be something that's easy to do but Drupal seems to make this really hard to achieve.

I've tried making custom blocks and types via the CMS but then it'd mean editing the content in 2 different places when we need to update areas or add new areas.

I've also tried building a block via a module but I cant seem to pass the information from a view into my template that way.

The blocks will potentially need to be added to more than one page if that' possible too.

What am I missing, why is this so difficult?

Thanks

Although the question is not so specific I would recommend to start from here Understanding Drupal > Overview > The Drupal flow and then move to Drupal Glossary (it is almost the same for 8.x).

This way it will be more easy to understand Drupal parts such as Theme , Region , Block , Template (using Twig for 8.x) etc.

Use the views module to create the block, then use the block layout page admin/structure/block to place the block in an appropriate region. Edit the block and configure the block and set its visibility settings.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM