O'Reilly logo

Drupal 7 Module Development by Ken Rickard, John Wilkins, Larry Garfield, Matt Butcher, Greg Dunlap, Matt Farina

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Exposing fields to the Form API with widgets

Although fields can be stored anywhere (or at least anywhere for which we write a storage engine) and accessed in a variety of ways, by far the most common user workflow is to create and edit an entity containing fields using a form embedded in a web page. In Drupal, all forms shown to the user are controlled by the Form API, introduced in Chapter 5. The way the field system exposes itself to the Form API is through widgets.

Widgets are simply Form API fragments that can get built into a larger form by Drupal. They can be very simple or very complex, depending on how we want to present information to the user. In fact, some of the greatest powers of widgets comes from the fact that the form elements ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required