How to Use ‘Views’ Module in Drupal

Drupal is an incredibly flexible Content Management System (CMS) with a vast library of modules that extend its functionality. One such module is the ‘Views’ module.

Views had the highest number of downloads in Drupal 7, and it prompted Drupal developers to add it to the core functionality of Drupal 8.

Let’s look at what makes ‘Views’ so great and how to use it in Drupal 7.

One of the most crucial factors of a website’s success is how it is displayed to the user. Drupal 7 includes some useful content types by default such as articles and basic pages – each with their own default types of display layout. But, what if you wish to add more types of display layouts such as ‘lists’? This is where the Drupal 7 views module comes into play. It has a number of configurations and can be integrated with more than 300 Drupal 7 modules.

The possibilities of views module are practically endless.

Here are some possible scenarios where ‘Views’ module will be helpful:

  • You like the default front page view, but you find you want to sort it differently.
  • You like the default taxonomy/term view, but you find you want to sort it differently; for example, alphabetically.
  • You use ‘/tracker,’ but you want to restrict it to posts of a certain type.
  • You like the idea of the ‘article’ module, but it doesn’t display articles the way you like.
  • You want a way to display a block with the five most recent posts of some particular type.
  • You want to provide ‘unread forum posts’.
  • You want a monthly archive similar to the typical ‘Movable Type/Wordpress’ archives that display a link to the ‘in the form of “Month,’ YYYY (X)”,’ where X is the number of posts that month, and displays them in a block. The links lead to a simple list of posts for that month.

Don’t just think of the ‘Drupal 7 views’ module as just a display option or a layout builder. Yes, it does allow for custom display types, but it’s a lot more than that. It can even filter content from a database, which allows the user to format and display in his required format.

To demonstrate the power of ‘Views,’ I’ll be making a simple blog index.

Install and Enable Drupal Views Module

First, you need to download, install and enable the ‘Views’ module if you haven’t done so already.

‘Views’ Content Type

Next, navigate to structure. Here you should see the ‘Views’ content type. Click on it to access the main ‘Views’ configuration page.

Add a New View

Once here, click the ‘add new view’ link at the top.

Name your view, then select the content type of ‘Article.

Next, in the ‘Create a page’ section, change the formatting if you wish and check the box beside ‘Create a menu link’ to link the ‘View’ in the main menu.

Once done, click ‘save and exit’ button at the bottom.

Check the New View

Now, navigate to the main menu and click the link for the view you created. You should be able to see the page in accordance with the parameters you set for the view.

Conclusion

As you could have guessed just from the simple example shown in this post, ‘Drupal Views’ is an incredibly powerful module and its popularity is a testament to that fact. ‘Views’ can seem to be confusing at the start, but the best way to get familiar with it would be to play around and find what its different settings can do for you. I hope this post proved useful to you.

Anjali Punjab

Anjali Punjab is a freelance writer, blogger, and ghostwriter who develops high-quality content for businesses. She is also a HubSpot Inbound Marketing Certified and Google Analytics Qualified Professional.