0

I created an Events content type. I created a vocabulary that has two category terms, Events and Plays.

I have a view that contains a list of all content of type Events.

Each Events listing displays with the category term as the title/link.

The link should go to a page that has a content pane (not a view page) containing a list of all of the Events with that tag.

I already have a page set up with two columns. When I click on any term in the list of Events, I want to navigate to this page (or an iteration of it, based on term selection), and one of the columns should contain the view pane with the view of events of just that category that was clicked on.

In other words, I want the destination of the term links to be a page containing the content pane of items of that category (i.e. not just a page view.)

So, the view looks something like,

Movie (term)

movieName

movieTime

Play (term)

movieName

movieTime

Movie (term)

movieName

movieTime

Play (term)

movieName

movieTime

Movie (term)

movieName

movieTime

The term field is configured to be a link.

If I click on Movie or Play I want to go to a page that has a content pane containing a list of all of the Events tagged with Play or Movie, depending on which I clicked.

On the view, I set up a Contextual filter:

Content: Has taxonomy term ID

I set up a Relationship:

Content: Taxonomy terms on node

How can I set this up so that clicking on the category will take me to another page with a column containing a view content pane that displays a list of Events based on that clicked tag?

1 Answer 1

0

Try this...

  1. In your view that displays movies and plays, add the term id (tid) to the list of fields.
  2. Rearrange your fields so that the tid field is above the term name field.
  3. In the tid field settings, check Exclude from display.
  4. In the settings for the term name field, check Rewrite the output of this field. In the text box underneath, enter this:

    <a href="path-to-page-with-content-pane/[placeholder1]">[placeholder2]</a>

Expand the Replacement patterns section of the dialog box to see what to insert in place of placeholder1 and placeholder2. Click Apply to close the dialog box, then save your view.

Now, in your content pane view, you simply have to match up the contextual filter with the tid. One way to do that is in your contextual filter settings, click the Provide default value radio button, select Raw value from URL from the dropdown, and set the path component to match where placeholder1 appears in the link generated in your other view.

This is the simplest way to do it and it has some limitations (e.g. a non-intuitive Url) but hopefully is enough to get you on the right track. One you're comfortable with it you can experiment with different arguments and different ways to pass them. The link below has a good description of how to use contextual filters:

https://www.metaltoad.com/blog/using-drupal-contextual-filters-views

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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