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…

  1. 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.
  2. Set the View name to My Content.
  3. 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 O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.