Drupal 7 Advanced Views Tip: Contextual Filters

Metal Toad · 57K views · 2012 · 5:13

Open on YouTube

Web developmentSoftware (other)tutorialdated

Why Drupal Answers Stack Exchange recommends it

Drupal Stack Exchange answerers point people to it as a quick, concrete walkthrough of Views Contextual Filters when asked how to pass node or URL values into a View or reuse one View across pages.

Recommended by 4 people across 4 different months, 2013 to 2015.

What it is

A five-minute screencast from the Drupal agency Metal Toad showing how to use Contextual Filters in Drupal 7 Views. It demonstrates changing the content a view shows based on dynamic values in the page URL, using a simple pets example.

What people said

Recommends Matt V. · 2013-01 · Drupal Answers Stack Exchange · on “Pass node field data into Views block”

The way I've typically seen that type of thing done is using Contextual filters (formerly called "Arguments" in Drupal 6). The Drupal 7 Advanced Views Tip: Contextual Filters [this video] screencast or this tutorial on Using Views Contextual Filters [LINK] should provide a starting point for using them. In short, contextual filters are like regular filters, except that they allow arguments to be passed in dynamically rather than the filter criteria having to be statically set ahead of time.

Recommends IvanSF · 2013-03 · Drupal Answers Stack Exchange · on “Create a 'universal' reusable View?”

What you may be looking for is "Contextual Filters" Here's a good tutorial I have that explains how to implement them: [this video] There's also a way to call a View directly from a template, which can be pretty useful in some cases: views_embed_view("slideshow_gallery", "page", array() );

Recommends Chris Charlton · 2014-05 · Drupal Answers Stack Exchange · on “How does Views contextual filters work?”

Here's a video and its related article that'll explain you how to use them, the example uses Pets (Dogs, Cats) which may be a simple enough example to help understand how to use Views Contextual Filters. VIDEO: [this video] (YouTube video short-url: lJFMTDuaxy8) ARTICLE: [LINK]

Recommends Chris Charlton · 2014-05 · Drupal Answers Stack Exchange · on “One view for multiple pages?”

I know what you're trying to do with Views, and it's easier than you think once you get comfortable with Views Contextual Filters. Check out this video (or the text version article) that clearly walks through how to use Drupal Views Contextual Filters. The linked examples use Pets (Dogs, Cats) as sample data, so you'll see how to filter Cats versus Dogs quickly. VIDEO: [this video] (YouTube video short-url: lJFMTDuaxy8) ARTICLE: [LINK]

Recommends DeveloperWeeks · 2015-11 · Drupal Answers Stack Exchange · on “Passing a node variable into views filtering”

Yes, this is possible. You are wanting a context filter [this video] . More details about your situation will let me give a better answer.