Drupal 8 Views Module

From Training Material
Jump to navigation Jump to search

THIS IS A DRAFT

This text may not be complete.


title
Drupal 8 Views Module
author
Lukasz Sokolowski

Drupal 8 Views Module

Drupal 8 Views Module Training Materials

Drupal views overview ⌘

  • Intro and examples of use
  • Creating a view
  • Filtering a view
  • Exposing filters
  • Passing arguments to a view
  • Views Add-on Modules

Introduction ⌘

  • Extremely powerful, and one of the "killer" modules for Drupal
  • In Drupal 8 it's a core module enabled by default (Views, Views UI)
  • Provides an easy-to-use interface for selecting and displaying lists of content on your website
  • Under the bonnet it's an SQL query to the database

Examples of how to use Views ⌘

  • Displaying the most recent news articles, sorted in desc order by the date of posting
  • Showing a list of company locations as a table that is sortable by clicking the table headers
  • A gallery with pictures/videos
  • A slideshow with any content
  • Displaying a calendar
  • Making list of blog postings, filterable by subject
  • RSS feed which lists the most recent content
  • Any kind of list that we can think of, displayed as table, etc

Creating View ⌘

  • Beginning setup, Save and edit, Save
  • Displays (Attachment, Block, Embed, Entity Reference, Feed, Page, other from 'add on' modules)
  • View name
  • Description
  • View Settings
    • Formats (Grid, HTML list, Table, Unformatted list, other from 'add on' modules)
    • Fields, Filter Criteria, Sort Criteria
  • Page Settings
  • Block Settings

Filtering a view ⌘

  • You may restrict what content is rendered in the view by adding filter criteria to the view display
  • This page (override)

Exposing filters ⌘

  • We can expose the filter to the user so they can control what content is displayed by the view
    • For example we can allow users to select which terms to filter on (tags)
    • "Expose this filter to visitors, to allow them to change it"
    • "Filter type to expose"
    • Label
    • "Allow multiple selections"

Passing arguments to a view ⌘

  • Allow to filter based on
    • from the url
    • from the context (panels)

Views Add-on Modules ⌘

  • Views Slideshow (www.drupal.org/project/views_slideshow)
  • Calendar (www.drupal.org/project/calendar)
  • JCarousel (www.drupal.org/project/jcarousel) - not ported yet
  • Draggable Views (www.drupal.org/project/draggableviews)
  • GMap (www.drupal.org/project/gmap)
  • Views data export (www.drupal.org/project/views_data_export)

Views and relationships ⌘

  • Displaying data from two nodes in one row (e.g. page title and authors date of birth)
  • Using relationships in filters

Analysing and Searching Data ⌘

  • Views Bonus Pack
  • Views Fast Search
  • View Calc

Dynamic Reports ⌘

  • Filtering date range
  • Charts
  • Summaries, sum, average, min, max, etc...
  • Calculated fields
  • Cross table reports

Exporting and importing views ⌘

  • Exporting a view
  • Importing a view
  • Hard coding a view in your module

Exporting views data ⌘

  • Exporting data to Microsoft Excel (CVS)
  • Exporting data to Microsoft Word document and other formats

Exercises