Add a contextual filter to a view
You can configure a view so that it is filtered dynamically, depending on the context. For example, you could use a contextual filter to add a block that contains related content or that presents a list of articles by the same author.
Prerequisite: To create a contextual filter that is based on a context other than the information in the URL, you may need to create a relationship. For more information, see Add a Relationship to a View.
- Navigate to the edit screen of a view (for example, admin/structure/views/view/MYVIEWNAME/edit).
- Click Advanced.
- In the Contextual Filters area, click Add.
- From the Add Contextual Filters list, select one or more filters and click Apply and Configure Contextual Filters. The Configure Contextual Filter dialog box displays.
- In the When the Filter Value is Not Available section, specify one of the following options:
- Display all results for the specified field
- Provide default value
- Hide view
- Display a summary
- Display contents of "No Results Found"
- Display "Access Denied"
- If you want to specify a different behavior for certain situations, in the Exceptions section, specify a value for exceptions.
- In the When the Filter Value is Available or a Default is Provided section, specify one of the following options:
- Override title
- Override breadcrumb
- Specify validation criteria
- Click Apply and Continue. Repeat steps 5 through 7 for each selected filter.