0

I'm doing a website with gallery in Drupal 8. I have articles with taxonomy terms (birds, mammals, reptiles, wood etc.) I've created a view (view1) to display only images from articles. I created a view for each taxonomy term. Some articles have a multiple taxonomy terms, so they are displayed in more than one view. I created also a view (view2) display a full content of article with a pager, so you can go to the next article in the same category.

I want to relate these views: If I click the image in view1, I want to go to view2 and display the full content. Is there a way to achieve this?

closed as unclear what you're asking by Jdrupal, No Sssweat, leymannx, Yusef, kiamlaluno Nov 11 at 6:22

Please clarify your specific problem or add additional details to highlight exactly what you need. As it's currently written, it’s hard to tell exactly what you're asking. See the How to Ask page for help clarifying this question. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 1
    The question is unclear. The way it is worded makes it sound as if you want to click the image in view1 and display the full content of the Node. My answer below describes how to do this. It's not clear exactly what the desired behavior of the pagers should be. Do you want to have multiple pager blocks appear for articles with multiple taxonomy terms? (Prev / Next Bird, Prev / Next Reptile, etc.) – hotwebmatter Nov 8 at 19:51
0

I don't think you actually need to "relate the two Views displays" in the way you are thinking.

This is a bit confusing in Drupal, because Views (provided by the Views module in core) have displays. But Content Types also have configurable displays, which are sometimes referred to as "view modes," so there are different meanings of "View" and "Display" depending on whether you're configuring the presentation of a Content Type, or configuring the Views module. You'll need to understand both meanings to accomplish what you're trying to do.

(I generally use "Views" with a capital V when referring to the Views module, and "view modes" with a lowercase v when referring to content displays -- but Drupal itself sometimes capitalizes "View mode" and people use the terms interchangeably on forums, so just be on your toes.)

You've already got the gallery View set up to display thumbnails of the images from your Article content, so it's likely that in the View, you have configured Show: Content | Teaser by setting the row style options to Content with View mode: Teaser.

You can easily link each of these thumbnails to the full content of the Article by configuring the Teaser display of the Article Content Type:

/admin/structure/types/manage/article/display/teaser

Click on the gear to configure the Image field, and set Link Image To: Content (under the FORMAT section). This will automatically link each thumbnail to the full content item.

Link image to content

The "full content item" is the Node, and it does not need to be part of any View. Instead, you can just show the pager in a Block on the Node.

This blog post shows one way to set up a pager that might work for you.

It uses the Drupal 8 Pager module, which might simplify the configuration -- but it should also be possible to implement this in straight Views by creating the pager as a Block display and then placing its Block in a theme region for content type Article, using the same technique described in the blog post linked above.

EDIT: I think maybe you want to create multiple Pager blocks (one for each taxonomy term) and have them appear on the Node pages of your Article content. Could you edit your question to clarify whether this is what you intend?

  • Thank you for your answer. I have already done as you said. Image from view1 had a link to the content. I had a pager (for each taxonomy) displayed in article based on term taxonomy. But as I said some of articles have a multiple taxonomy term, so in that articles was a few pagers (I want to have an option to click "next article" in selected category). I Also have a view that display images from all articles (all categories together) so it's another pager. – Skylar Hunting Nov 8 at 15:28
  • @SkylarHunting Maybe your question is how to configure pagers to appear only on Article nodes with the matching taxonomy term? – hotwebmatter Nov 8 at 16:24

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