How To Send Contextual Filter To View Block Using Js
Description
Collection: Drupal viii Site Edifice
Chapter: How to use exposed filters and contextual filters in views
Contextual filters are a useful feature of views that permit yous to pull variables from the environment where the views is displaying - usually additional data in the URL - and use it to filter which content gets displayed in a view. Here nosotros use a contextual filter and set it to filter based on the current folio'due south node ID. This way nosotros can use the aforementioned view in multiple places, but information technology will only display the tours that match the tour type currently being viewed.
Transcript
So we can jump to each of the tour types by clicking on it here. And when we do, the one affair that information technology'south not doing is filtering past tour type. So, on Extreme Snorkeling, we should only run across the Extreme Snorkeling tour.
What we demand to do in views is make a connection betwixt the page that nosotros're on, in particular, the node ID of the page that we're on, and the node ID that we're going to use to filter this tour type. Okay, so let's go dorsum to our view. I'yard going to become to Structure, Views, search for tour, edit, let's get back to our block, you always wanna make certain you're on the correct display, 'crusade it's a pain making edits in the incorrect brandish, and then having to coil them dorsum.
So, over here under advanced, we have contextual filters, allow'south click add. And so the idea of a contextual filter is that by default, information technology takes values from the URL and uses those to filter out the data in the view. But, yous can also use information technology in order to pull some data from the environment.
For example, you tin filter by the currently logged in user, or, filter by the node ID of the c ...
Read the concluding half of the transcript
You are 0% consummate
When you have an active membership, you will be able to run into your progress here.
Skill focus: Site Building
Skill level: Beginner - Intermediate
If y'all're looking to get started with Drupal 8, this is a nifty place to begin. In this serial nosotros build a practical Drupal eight site from offset to terminate and become immersed in the about essential techniques, terminology and tools needed for both professional and hobbyist site builders. No matter how y'all work with Drupal 8 - equally a site builder, programmer, forepart end developer or projection manager - what you learn here will provide a solid foundation.
Nosotros cover a lot of material in this serial, including these central points:
- How to construction content and work with comments
- How to evaluate, install and configure modules
- How to utilize views to brandish lists of content
- How to create relationships between content and use them in content lists
- How to improve performance and security
- How to piece of work with blocks and structure custom cake types
- How to work with taxonomy, paths, and much, much more
Who this collection is for
This video collection is intended for those who are completely new to Drupal, or for those that desire to brand sure that they accept a solid foundation before moving on to more advanced projects. Nosotros assume you lot know nothing about Drupal, and lead you from starting time to finish through a practical project.
Prerequisites
There are no specific prerequisites for this drove.
How To Send Contextual Filter To View Block Using Js,
Source: https://buildamodule.com/video/drupal-8-site-building-how-to-use-exposed-filters-and-contextual-filters-in-views-what-a-contextual-filter-is-and-how-to-show-content-that-references-the-current-pages-node
Posted by: ramirezdadogiag.blogspot.com

0 Response to "How To Send Contextual Filter To View Block Using Js"
Post a Comment