Utilizing dynamic arguments
Views can be configured to accept contextual filters. Contextual filters allow you to provide a dynamic argument that modifies the view's output. The value is expected to be passed from the URL; however, if it is not present there are ways to provide a default value.
In this recipe we will create a new page called My Content
, which will display a user's authored content on the route /user/%/content
.
How to do it…
- Visit Structure and then Views. This will bring you to the administrative overview of all the views created. Click on Add new view to begin creating a new view.
- Set the View name to My Content.
- Next, we modify the View settings. We want to display Content of the type All and leave the Tagged with empty. This will ...
Get Drupal 8: Enterprise Web Development now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.