Drupal 7 Views Module Tutorial 6 of 10 - Views Relationships and Contextual Filters

Web Development Tutorials · 41K views · 2013 · 21:32

Open on YouTube

Web developmenttutorialdated

Why Drupal Answers Stack Exchange recommends it

Drupal Stack Exchange answerers link it when someone needs to understand Views relationships or contextual filters, such as showing user data or filtering a view by the current page's context.

Recommended by 4 people across 4 different months, 2014 to 2020.

What it is

Part 6 of a 10-part Drupal 7 Views tutorial series covering relationships and contextual filters. The presenter adds a relationship to pull in node author data, then builds a view filtered by user ID from the URL, with default arguments and validation. He explains relationships as the FROM clause and contextual filters as the WHERE clause of the generated query.

What people said

Recommends No Sssweat · 2014-06 · Drupal Answers Stack Exchange · on “How to configure a view accessible on user's profile only by that user”

If you don't want them to see their own content instead of the user which profile they are currently viewing, you need to add a contextual filter skip to 8:52 and watch Views Relationships and Contextual Filters [this video] Note: this is for drupal 7, but I imagine the drupal 8 views look the same.

Recommends jowan sebastian · 2014-12 · Drupal Answers Stack Exchange · on “views webform submission username”

'Username' as a field is not available to webform as it is not stored in the webform submission. You need to add a Relationship to the User using the UID and then the User Name will be available to you in the fields section. See more about relationships in this video [this video]

Recommends learnallskill · 2016-02 · Drupal Answers Stack Exchange · on “How can I override taxonomy term page?”

Sorry my reputation not high enough to add a comment. Anyway here is the link might able to help you. Create Views [LINK] Views Relationships and Contextual Filters [this video]

Recommends oliver_siegel · 2020-08 · Drupal Answers Stack Exchange · on “How to create block to list all children of an entity?”

Finally, I figured it out! First, I learned more about contextual filters and relationships, and what they each mean and do (relationships basically relates to the FROM query, contextual filters to the WHERE query) [this video] Another user had a similar question and solved it like so: [LINK] So all I had to do was: /admin/structure/views/add show content of type "Locations" Create a block Then under "advanced" add a contextual filter, check "parent_location (field_parent_location)", press the button to "Add and configure". Then under "When no filter is available" say "provide a default value" and select "content ID from URL" Hit apply, save the view. Under /admin/structure/block place the block