O'Reilly logo

Drupal 8: Enterprise Web Development by Chaz Chumley, Matt Glaman, Richard Jones, Nick Abbott

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

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 ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required