Contextual filters for filtering by path parameters
Views can be configured to accept contextual filters, also known as arguments. Contextual filters allow you to provide a dynamic or fixed argument that modifies the view’s query. Think of it as the root condition in the query. By default, the value is expected to be provided from the URL; otherwise, a default operation can be chosen if it is not present.
In this recipe, we will create a new page called My Content, which will display a user’s authored content in the /user/{user_id}/content
path. The value of {user_id}
will be any user ID that is available in Drupal.
How to do it…
- Go to Structure and then Views. This will bring you to an administrative overview of all the views that have been created. Click on Add view to create a new view.
- Set View name to My Content.
- Next, we will modify the View settings section. We want to show Content of the All type and leave the tagged with field empty...