Module Development

In part 1 of this tutorial, I covered how to make your own custom field and widget. Here I'll cover how to validate that input and format it using a custom formatter.

The power of Drupal stems from our ability to customize it. One common requirement is the need to define complex fields with custom widgets and formatters that are unavailable in core or contributed modules. This allows us to collect more sophisticated data from users, and define exactly how that data is presented. Drupal 7's Field API provides the hooks needed to make just about any field we want.

Montreal's March Drupal Meetup was held this past Wednesday at Notman House, a co-working space and hub for entrepreneurship and tech innovation in Montreal. I think the exciting new venue was at least partly responsible for the fantastic turnout of 28 Drupal enthusiasts.

We often define custom blocks in a site-specific module. Sometimes the markup in these blocks can start building up and we realize that it's time to create a template for the block. This is a good way to keep markup out of the module code. It's also a good way to practise writing cleaner and more themer-friendly modules.