October 2, 2015

In the previous post, we discussed how to write a style plugin for Views in Drupal 8. In this post, we will see how to allow the user to configure our style plugin.

We had previously created a class named CardsStyle for the plugin. In order to add configuration options, we will need to extend that class with two new method: buildOptionsForm and defineOptions as follows.

September 14, 2015

Drupal 8 is just around the corner, and it has reached an important milestone: beta-to-beta updates will be provided for each beta release going forward. That gives me some confidence that no major re-works are to be expected if I start building with Drupal 8. That said, we are still facing a sizable documentation gap regarding the changes in the API. My first encounter with this problem was when I was building a custom style plugin for Views.

May 26, 2015

When I need to filter a view based on some elaborate condition, I often find myself using Drupal Views' contextual filters. Normally this kind of filter is supposed to pull the filter value from the URL, but it also lets you select other methods of finding a value if it’s not in the URL. For instance, if the filter is for the author, you can configure the view to use the current user’s ID. Even though this is very flexible, you may occasionally need filtering that cannot be set up with the available options.

June 12, 2014

While working on a recent project, we found ourselves in a situation where we needed to customize a Views field in a way that was not possible using Views' configuration or theming. In such cases, writing a custom Views handler might be the best or only option.

May 30, 2014

Views is an essential part of any Drupal site. It is very versatile and allows non-developers to set up all kinds of listings of their content. However, no matter how versatile it is, you will always find a scenario that is not feasible to set up on its user interface. But if you are a developer, you have even more ways of manipulating views.