Developing Custom Views Plugins: Falling back in love with Views

Many developers have a complicated relationship with Views. The module offers a wide-range of out-of-the box functionality, including: query building, routing, cache controls, permissions, menu integration, and display rendering logic, among others. Even with all of these features, developers may choose to skip Views and create custom-code solutions, because:

  • We like to reinvent the wheel -- creating the best and leanest solutions for our clients;
  • We want to stay organized -- building complex solutions in modules rather than layers and layers of configuration;
  • We hit the limits of Views -- finding customer requests can’t be accomplished through out-of-the-box Views functionality.

Luckily, there is another way to have our custom code without giving up the power of Views. This session will explore creating custom Views Plugins to add functionality and logic to the Views interface. We will discuss common reasons a site may need features beyond out-of-the-box functionality and we will look at real life examples of Views Plugins. Topics includes:

  • Introducing how Views builds, executes, and renders queries and displays.
  • Exploring business cases for using Views Plugins vs altering data by hooks.
  • Adding custom Fields, Filters, Arguments, Sorts and Joins beyond what is offered by default with Views.
  • Reviewing example code and practical use cases for modifying Views queries.

View Plugins can allow developers to keep their code organized, abstracted, and highly functional. We can package custom code into the standard Views interface. Most importantly, they can help save us time and reduce technical debt by organizing our custom code through standard interfaces.

This session is for anyone who is comfortable (or willing to try) writing code in a custom module. Advance knowledge of Drupal or databases is not required to get started.

Session Slides
Attachment Size
2020 BADCamp Slides.pdf 4.32 MB
Presentation Video
Friday, October 16
1:00pm - 1:45pm (PT)
Back-end Development