Categories

(83)
(69)
(8)
(34)
(74)
(149)

Supercharge your Drupal 8 website with special powers of Views

27.10.2017
Supercharge your Drupal 8 website with special powers of Views
Author:

The Views module lets even non-developers organize and present the website's content in the desired ways. Website administrators love it, Drupal newbies start with it, and Drupal ninjas perform miracles with it. No wonder it used to be the most downloadable contributed module. Well, it still is — in Drupal 7. But, with the arrival of Drupal 8, it got an even higher position — the Views became part of Drupal 8 core, so it no longer needs to be downloaded separately. The Views “inside Drupal” is listed among Drupal 8’s best improvements. Let’s discover a couple of special capabilities of the Views that will let you enhance your Drupal 8 website.

The Views: a true behind-the-scenes architect for websites

Lists, graphs, maps, tables, blocks, calendars, comments, contact forms, photo galleries and carousels, blog posts… The Views module shapes all this and much more with the data it fetches from the database. It looks attractive!

However, despite the name, the essence of Views lies much deeper than the attractive content presentation. Its behind-the-scene work is priceless. The module lets you not just list your entities, but also filter and sort them in all kinds of ways, change attributes, create relationships, and give or deny user access. The Views caches the data to improve your website’s performance. The list could go on. Here are a few examples of its special capabilities.

Some special ways to use Views on your Drupal 8 website

Views and REST export

Share your content with some other system — for example, a mobile application or one built on the basis of JavaScript. It’s possible to output your views in JSON, XML, HAL+JSON, or other non-HTML formats.

Setting up REST API export with Views is easier in Drupal 8 thanks to built-in web services like Serialization, RESTful Web services, HTTP Basic Authentication, and HAL. They need to be enabled.

The “Provide REST export” field is already included into the Views setting form and just waits for you to check it.

Using Views with a third-party data store

Your Drupal website’s “classic” SQL database is far from being the only possible data store for the Views. There are useful data source plugins ready for Drupal 8 — Views XML Backend, EntityFieldQuery Views Backend, Socrata, Elasticsearch Connector, Google Analytics Reports, and more.

Slideshows and carousels

Make your website even more attractive by creating slideshows and carousels, which can include various kinds of content and be responsive. Add-on modules for the Views like Views Slideshow, Slick Carousel, Slick Views, and Views Bootstrap will help you with it.

Contextual filtering

Among the great filtering and sorting options of the Views there’s an option to set up content-based filtering based on dynamic information. For example, you can display all content created by certain users. Contextual filters are very convenient because the values are fetched programmatically or via a URL.

Adding a relationship to Views

To present related content on your Drupal 8 website, it’s necessary to create a relationship to a view. Then you will receive information that is not contained in the base table selected during the Views creation. In the advanced settings of the “Display” page, you will find the “Add relationship” button and a selection of tables to pull data from.

Embedding Views

Sometimes it’s necessary to embed Views in your pages using PHP code. For this, there is a special views_embed_view() function.

Final thoughts

This has just been a very small collection of the Views module’s special powers. It also has many more to supercharge your Drupal 8 website with. Our Drupal developers are ready to use them to the full for your website’s benefits!

2 votes, Rating: 5

Read also

1

Using the Superfish Drupal module, which integrates the jQuery Superfish menu plugin, you can create interactive multi-level menus with exceptional usability features. Let’s see how it works on...

2

Every six months, there comes a fresh Drupal 8 minor release full of lucrative features. And another big day has come! Drupal 8.4.0 is out on October 4, making this autumn especially rich in gifts...

3

We have a confession to make. Frankly, we’re becoming kind of shopaholics ;) After the release of Drupal Commerce 2.0, our passion for discussing and building cool Drupal 8 online stores keeps...

4

It’s always been known that Drupal is a great choice for e-commerce websites. On September 20, the long-expected Drupal Commerce 2.0 for Drupal 8 has been released. Let’s look through some...

5

Drupal 8’s “fruitful fields” of opportunities are endless — so let’s take another walk through them! Along with everything else, Drupal 8 also lets you create custom field formatters...

Subscribe to our blog updates