New Series: Coding for Views

Views is without a doubt the most popular module on, and one of the reasons for it’s popularity is the plethora of modules that enhance the out of the box views experience. These modules add new display options like a calendar or Javascript caoursel, new formatters for existing fields, and even new backends so you can query things other than MySQL. Like Drupal itself views is written to be extended and it’s not uncommon to need to do just that in order to meet your site specific requirements.

In the new Coding for Views series we’re going to take a look at writing modules that interact with views in a variety of different ways. There are far more than we could cover in a single video series so we tried to address the touchpoints that we’ve seen used in the wild the most and left some the more esoteric ones as an exercise for you. The series and most of the code written starts by extending the databasics module created in the Drupal 7 Module Development series so if you have not watched those videos yet you might want to start there.

We’ll walk through implementing the views API to export the definition of a view in to code for portability, exposing database tables provided by your module to views and describing each of the fields on your table, creating custom field handlers to modify the formatting, sorting, filtering, and other aspects of your fields. Then we’ll take a look at writing some views plugins to add new access plugin and a new display style and then we’ll wrap it all up with a little bit of theming.

The first three videos are available now:

We’ll be releasing the rest of the series over the next couple of weeks and can finally check-off one the most requested series in the history of from our to-do list. Enjoy!


Add new comment