Add a contextual filter to a view
Last updated on
1 December 2021
This documentation needs work. See "Help improve this page" in the sidebar.
[INCOMPLETE]
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/MY_VIEW_NAME/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 section When the Filter Value Is Not In The Url, 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 different behavior for certain situations, in the Exceptions section, specify a value for exceptions.
- In section When the Filter Value Is In the Url or a Default is Provided, specify one of the following options:
- Override title
- Specify validation criteria
- Click Apply and Continue. Repeat steps 5 through 7 for each selected filter.
Help improve this page
Page status: Needs work
You can:
You can:
- Log in, click Edit, and edit this page
- Log in, click Discuss, update the Page status value, and suggest an improvement
- Log in and create a Documentation issue with your suggestion