Topic

Fields

Fields are the building blocks of Drupal's powerful content modeling system. The Field API allows for the development of custom field types, field widgets, and field formatters to suit almost any data display and collection needs. When combined with entities, which allows for the attachment of fields to entity bundles (commonly known as content types), Drupal becomes infinitely flexible without requiring writing any code.

Example tasks

  • Understand how the main components of Drupal's field system fit together
  • Learn how fields can be used to customize your site
  • Customize existing fields and create new additional functionality within your own modules

Confidence

At this point in the development cycle, the Field API is stable. Contributed modules that provide additional field types and add functionality to the field system are likely to emerge, but the main components of the core functionality are unlikely to change.

Drupalize.Me resources

We are still filling out our Drupal 8 library and this page will be updated with new tutorials as they are created.

Fields and Entities are closely related concepts. It is best to learn both.

More Guides

We have guides on many Drupal skills and topics.

Explore guides

External resources

  • 2.3 Concept: Content Entities and Fields (drupal.org)
    • The role of content types and fields in Drupal.
  • FieldTypes, FieldWidgets, and FieldFormatters (drupal.org)
    • Overview of field types, widgets, and formatters for developers. Includes a handy list of all field types in Drupal core
  • Field API Documentation (api.drupal.org)
  • Field Types API Documentation (api.drupal.org)
    • Together these two links constitute the main API documentation pages for the Field and Field Types APIs. The other pages linked to from here, including the widget and formatter APIs, cover the bulk of the functionality behind Drupal's field system.
  • Creating a custom Field (drupal.org)
    • This tutorial, along with others in progress from drupal.org, walks through the process of creating a custom field.
  • Examples for Developers (drupal.org)
    • The examples projects contains an example module (field_api) with sample code demonstrating adding a new field type, widget, and formatter.