Check your version

This video covers a topic in Drupal 7 which may or may not be the version you're using. We're keeping this tutorial online as a courtesy to users of Drupal 7, but we consider it archived.

Alternate resources: 

Drupal 7 Field API Fundamentals

Video loading...

Join Drupalize.Me to watch this video

Join today and gain instant access to our entire video library.

Log in Sign up
  • 0:08
    Before we dive into the code and start writing
  • 0:10
    our own custom field module, let's take a couple of minutes
  • 0:13
    to familiarize ourselves with some basic terminology
  • 0:16
    and components of the field API.
  • 0:18
    There's a lot of terminology and it can be a bit confusing, especially
  • 0:22
    since there's a lot of overlap in what the word field means depending
  • 0:25
    on the context in which it's used.
  • 0:28
    In this lesson, we'll talk about what the field API does,
  • 0:32
    the difference between field types, widgets, and formatters,
  • 0:36
    and some other background information that will make working

Drupal 7 Field API Fundamentals

Loading...

Before diving into the code it's important to understand some of the building blocks that make up the Field API. There's a lot of different terminology in the Field API and it helps to understand what each of the terms mean. As well as understanding the relationship between the Fields and Entities in Drupal 7. Knowing these things will give you a strong foundation on which to start exploring the Drupal 7 Field API.

Terms & concepts covered in this video:

  • What is a field? what is an instance?
  • How do fields relate to entities?
  • Field types
  • Field storage
  • Field widgets
  • Field formatters

For more information about these terms see the Drupal.org handbook page: https://drupal.org/node/443540

The Field API in Drupal 7 is actually made up of a bunch of different APIs. In this series we'll be focusing on the Field types API which is used to allow modules to define new field types, widgets, and display formatters. The Field types API is the most commonly used by custom modules.
 
The Field API consists of a set of hooks that you can implement to define your own custom field types with their own unique data collection widgets, storage schema, and behaviors. And sets of functions that can be called to do things like retrieve information about defined fields, pragmatically attach fields to an entity type, and interact in other ways with fields defined by core or other modules.
 
In addition to the Field types API there is also:
 

  • Field CRUD API - creates field instances and bundles, e.g.) what you see on the manage fields page.
  • Field attach API - connects entities and fields, uses info from Field Info API to retrieve defined fields and do things like display their widget on the appropriate entity form when someone tries to edit an entity.
  • Field info API - retrieve information about defined fields and instances.
  • Field storage API - pluggable back-end storage for fields. Defaults to SQL backend provided by core.
  • Field language API - provides native multilingual support for fields.

Additional resources:
There are no resources for this video. If you believe there should be, please contact us.