Learn Views in Drupal 8

One of the big changes in Drupal 8 is that Views, the most popular contributed module in Drupal 7, is now included as part of core. Learning Views is a key component of building Drupal sites. Aside from having this tool built in core now, the beauty of this new feature is that it is almost identical to Views in Drupal 7. You can get started site-building with Views in Drupal 8 without waiting for any fancy version-specific instructions.

For most people who are new to Drupal, the first step after creating content is to learn how to list that content in various ways on your site. This is where Views is your tool of choice. The Views interface has changed very little between versions, as can be seen in these 2 screenshots of the default Views interface. As a matter of fact, there are only a few minor tweaks in less-used features. Many people won’t notice the differences.

Drupal 7

Image
Drupal 7 Views interface

Drupal 8

Image
Drupal 8 Views interface

You can easily follow a Drupal 7 views interface tutorial, like our Introduction to Views or Using Drupal series tutorials, in Drupal 8 and achieve the same results.

One thing you’ll note is that Drupal core is now using Views to power its listing pages, so a lot of default views are already enabled for you on your new site. In Drupal 7, you had to enable the default views before you could actually use them. Drupal 8 still comes with 2 that are not enabled out of the box, Archive and Glossary, but otherwise you’ll see that you have more default views in Drupal 8 — and almost all of them are enabled.

Differences

There are a few minor differences in the user interface. For instance, the “No Results Behavior” setting has been moved out of the Advanced area into the center settings column, and the word “clone” has been changed to “duplicate” — but these are minor changes that shouldn’t break your stride.

There is also a very small list of items from Drupal 7's Views that are absent from Drupal 8:

Theme information link is gone.
In Drupal 7, you could get a handy list of the theme template files and suggestions for naming overrides right in the user interface, under the Advanced section. In Drupal 8 you should instead use Twig debugging to show you where the template file in use is located and then you will override that file as per usual in Drupal theming. (Also note that, of course, Views theme files are now in a core directory, core/modules/views/templates.) For some examples of template files and the naming conventions to use for overrides, take a look at api.drupal.org.

Field Language setting is gone.
There used to be another field under Advanced that let you set a language at the field level for your view. The underlying multilingual system received a lot of improvements in Drupal 8 and this setting was removed because “rows in entity views should have a language associated with them, and we should filter/sort based on language at the entity/row level, not at the field level.” (From the "Field language filter/sort/etc. for Views do not work and are not needed" issue.)

Advanced Help is no longer used.
Since Views is part of core, instead of using Advanced Help module it now uses the core help system and online documentation.

Something New

Views isn't the only newcomer to core. Now that various Web Services modules have been added to core, when you enable them, you will have access to a new "Responsive Endpoint" display type. This display type enables you to set a path and output JSON. This can be handy for integrating segments of your content with JavaScript.

Gotchas

Like most software, there are still bugs for Views in core, so if you find something that isn’t working the same way as it did in Drupal 7, you might want to check out the open Views issues. Now that Views is part of core, you need to search within the Core project, instead of the contributed Views project. You will need to select the views/module component in the core issue queue.

Image
Drupal Core Views issue queue

One issue worth mentioning and which is likely to cause some furious cursing is “When deleting a content type field the related View also is deleted”. In Drupal 7, when you deleted a field that was also used in a view, you would get a missing handler error in your view. With this bug in Drupal 8 when you proceed to delete a field from a content type, Drupal's Configuration System will list all of the changes to configuration. If you see a view listed under deletions, and you confirm the field deletion, that view will be deleted as well.

As you can see, there aren’t really many differences, so you should feel confident forging ahead with Views in Drupal 8 because you have an entire world of Drupal 7 Views tutorials to guide you on your way.

Comments

Thanks for your comprehensive evaluation of differences in the Views module between D8 and D7.

On the one hand, this all seems like very well written and useful information. On the other hand, it isn't really helpful for someone that wants to "Learn Views in Drupal 8". I came here from a Google search as a first time Drupal user and found nothing to really help me. I'd suggest changing the post title to something more accurate like, "Changes in Views Between Drupal 7 and Drupal 8". And with that thought, I'm off to find a post that will actually help me learn views in Drupal 8.

Add new comment

Filtered HTML

  • Web page addresses and email addresses turn into links automatically.
  • Allowed HTML tags: <a href hreflang> <em> <strong> <cite> <code class> <ul type> <ol start type> <li> <dl> <dt> <dd><h3 id> <p>
  • Lines and paragraphs break automatically.

About us

Drupalize.Me is the best resource for learning Drupal online. We have an extensive library covering multiple versions of Drupal and we are the most accurate and up-to-date Drupal resource. Learn more