What is Views?

Drupal Views is a listing of information. It might include a list of nodes, users, comments, terms from a taxonomy, files, etc. Using any criteria you set, a view analyzes your website and displays the findings in the format of your choice. 

Displays can be in the form of blocks or pages, and a single view can have numerous displays. Example formats include an HTML table, teasers or pictures that link to articles, Blocks, an RSS feed, a PDF document, a CSV document, an interactive map, an image slideshow, or a JSON representation to be used as a REST endpoint. The same view can be delivered simultaneously in different formats. For instance, you could display a table of user information and a link to download the information in CSV format on the same page.

Technically, Views is a tool to fetch data, process data, and display data, which is a quite broad field to work in.

Understanding Views terminology

  • Views module
    The Views module is one of the most used of all the contributed Drupal modules. It is the engine of the whole system. The Views module handles the display of views, allowing you to retrieve data from the Drupal database, compile a list of results, and display them in different output formats.
    One of its many advantages is that site builders don't need to be really knowledgeable about SQL or the specifics of the underlying database architecture. In most situations, having a fundamental understanding of Drupal terms like nodes, content types, and fields is sufficient. It is possible with the Views UI module to create view instances that contain the settings for what elements to display and how.
     
  • Views UI module
    The Views UI module is the visual user interface of the system. It allows you to create and edit the views in the administrative interface. The setup wizard it provides will guide you through the process of setting it up. 
    Optionally, the Views UI module can be removed or uninstalled once all the views for a site have been built, but the individual view instances will still continue to function.
     
  • view instance
    A view instance is a collection of parameters that specify how data will be gathered and shown to site visitors in Drupal. Multiple displays may be present in a single view. Examples of views displayed are the following
    • page with a specific URL route
    • a block to be placed in a theme region
    • or a feed that can be exported in RSS or OPML formats


It will be possible for you to set a presentation format for each sort of display. Values may depend on the type of display. Tables, unformatted lists, HTML lists, and grids are all acceptable substitutes for page displays. Modules offer display and output formats. You might have more options as you install new contributed modules or enable more core modules.

The main parts of a view

To access the overview page for the Views module, navigate to /admin/structure/views. There you’ll find the list of all views available on your website. There are several pre-configured default views included with Views that you can enable. Archives, Backlinks, Front Page, and Glossary are a few of them. Each view is listed along with a brief explanation, any paths the view may take, and further details.

Working with the view in the administrative interface, you will see various parts/sections that allow you to specify what data to output, in what order, and in what format. All views rely on a conceptual framework that includes:

  • Fields
    Fields are the individual pieces of data being displayed. Depending on the chosen format, you might be able to customize which content fields are output. 
  • Filter criteria
    Filters limit the items displayed in the results depending on the criteria such as the type of content, a field value, or if the content is published or not. For example, you would need to filter a view display to the Person content type, and to published person contents. 
    Additionally, filters can be exposed, allowing users to select their own filter settings from a form. This would be useful in a Person Information page to let users filter for the person with a certain name, age, or address.
  • Sort criteria
    Sort criteria determine the sequence in which items are shown in view results. Any content field can be used for this. 
    For instance, sort the display by creation date in ascending order.
  • Contextual filters
    Contextual filters are similar to ordinary filters, but the values they use are determined by the context of the view display, such as the entire URL of the page being displayed, the current date or time, or another information that the view calculation can determine.
  • Relationships
    It is an information about how data elements relate to one another. Relationships enable you to expand the view’s display, by relating the base content being presented to additional content entities. For example, all content items have an author field, which references the user account of the content’s author. When a relationship is created, any fields from the referenced entity can be displayed in the view.

 

Views is a crucial feature and a key differentiator that sets Drupal apart from other content management systems (CMSs) and frameworks. We have barely begun to scrape the surface of its potential in this blog. Hope it helps!