Views in Drupal 8: How to Leverage Its Power to the Fullest 

Views in Drupal 8: How to Leverage Its Power to the Fullest 

For it would be a shame not to fully “exploit” this content structuring superpower at your fingertip! Sorting, presenting and modifying content to your liking will never be the same again. From (contextually) filtering it, to presenting it as related content, to “getting lazy” as your displays of content get automatically updated etc., using Views in Drupal 8 means leveraging both its power and its convenience (no line of code needed). It allows you to create strategically structured pages and/or blocks by simply checking a few boxes. Let me detail now:

But First Things First: What Is Views After All?

It's the module with the same name: THE “can't live without” contributed module for any Drupal developer in Drupal 7 (enabled on more than two-thirds of Drupal sites), leveled up to core in Drupal 8.

Taken as a verb is a way in which you can create dynamic lists in Drupal

… and its singular form, “view”, refers strictly to a particular single list!

Why Should You Bother Using Views?

Because it “controls” and therefore empowers you, as well, to control pretty much all the elements (lists and blocks) on your website!

And because presenting content on your website in an UX-enhancing, ideally structured way is as important as creating it.

Take it as a “control tower” where you're empowered to turn any content accessed from your site's database into tables, maps, graphs, lists, posts, reports, blocks etc.

And there's more! Leveraging Views in Drupal 8 to the fullest also means that you get to “exploit” its:

  • related content” capability: when you need to display a list of users along with the links to each one's content, for example 
  • contextual filter” feature: like when you want to present one of your site visitors customized, user ID-based content; you get to make one view work differently depending on your filter's values!
  • automated update” functionality: wouldn't it be cool if each time you added content to your blog the display of content got automatically updated (no more “manual work”!)?
  • fields: you get to put together multi-table data that incorporate fields from several content types

In short: you should, indeed, bother using Views in Drupal 8 if you want to leave the web designer that you're teaming up with literally... “mouth-opened”! By making the output look exactly as he/she fancied it.

Views in Drupal 7 Vs Views in Drupal 8 Core 

As if we hadn't grown “dependent” enough of Views in Drupal 7, “just” a contributed module back then, in Drupal 8 it's grown even more... powerful.

It controls everything! And so, it makes all your site's elements “easily modifiable” for you:

  • front page 
  • taxonomy page 
  • “who's online” block 
  • content admin page 
  • user admin page 
  • content list
  • user/people list 
  • files view 

… these are all customizable views in Drupal 8! 

How to Create a New View?

Power and simplicity (backed up by unmatched flexibility)! Yet when you create your first view in Drupal 8 you'll realize that: what starts like a simple form ends up turning in a “multiple box checking marathon”!

For you're sure “tempted” with lots of settings to scan through and to choose from: Add a new view> Name your view> Set your view type (which is “content” in 90% of the cases)> Check the “Create a Page” or Create a Block” box...

The checked “Create a Page” box will then unfold a whole “collection” of settings to decide upon, ranging from page title, path, display format and the list can go on and on... 

Which Are the View Types That You Get to Choose From?

Or the “base”, if you prefer. The one that you will then “build upon” by delving deeper and deeper into a “deep sea” of settings, fields, format types and displays to select from so that you can structure your content to your liking:

  • comments
  • files
  • users 
  • taxonomy terms
  • content revisions
  • custom block revisions 
  • custom blocks
  • other contributed or custom module-specific view types
  • log entries

How About the View Displays? 

Now that you've defined your very “foundation, the view type, it's time you chose your display of content, as well. It could be:

  • a page
  • a block
  • an attachment
  • embed
  • feed
  • master 
  • REST export 

Note: you get to rely on the new view wizard for creating common view types (e.g. a Block or a Page) only; as for the less-common ones, you'll need to create them manually on the Edit page!

Then You Have Format Options, Too 

What, did you think you were done with the box checking? Told you there would be a whole box checking “marathon” if you really wanted to use Views in Drupal 8 to its full potential!

Now it's time you selected the format of your content display and your option set looks like this:

  • Grid
  • Unformatted List 
  • Table
  • HTML list
  • Contributed modules-specific options: accordion, map, slide show

… And Format Options Settings 

Using Views in Drupal 8 is not just about leveraging bundles of convenience, but about learning to “master” the whole bunch of settings that come along, too

So, once you've picked your format options, pair them with proper settings, too:

  • align and re-order your tables to your liking
  • cast a “hocus pocus” and a make some of the tables disappear, based on certain propraties that you'll get to define
  • make them responsive 
  • etc.

Next You're “Tempted” With Multiple Fields 

Don't you just love a “good pile” of content types to scan your cursor through and to select from? Then you will surely love digging through the rich collection of fields that Views in Drupal 8 “tempts” you with, as well!

In a few words: Views in Drupal 8 is all about flexibility (you get to structure the output to your liking) and “predictability” (selecting fields will let you know how your view will come out, live, on your website) at its best!

… And Field Settings 

Since yes, fields come “loaded” with their sets of settings to select from, as well! 

Change your date format, add CSS to your fields, create a label, do all the customization work needed to tailor that piece of content to suit your needs in the slightest detail!

Views in Drupal 8: A Few Words About Filter Criteria 

Since this is by far one of the most “powerful” tools that Views puts at your disposal!

You get to set your filters so that they should display only a specific segment of your view's content/data, that you'll get to define! 

Just imagine all the convenience that you can fully “exploit”: instead of creating multiple view displays, each one with its own set of filters, Views in Drupal 8 lets your “harness” the power of contextual filters! Thus, you'll be building one single display instead of... several! 

You get to make that single view display work multiple ways! Efficiency at its finest!

The END! This is how my “pledge” for Views in Drupal 8 looks like! Hope my arguments have at least stirred your curiosity to take it out for a “drive test”. I tell you this: once you harness the power of all its content structuring and content display customizing tools and features, you will no longer imagine building sites in Drupal 8 without it!