Introduction to fields

Ready for review -- AWAITING PEER REVIEW
Description: 
This lesson briefly describes the usage and components of fields on a content type.
Overview: 

Fields have values (e.g. a date, like 5/16/2012) and labels (e.g. "Date:"). They are managed on the Manage Fields tab, and their display is controlled on the Manage Display tab. Once fields have been created on a content type, they can be shown on a node or in a view.

Steps: 

By default, Drupal nodes store a title, a body, and a variety of metadata including the time it was published and the user who published it. Content administrators often need to store more data than that. For example, a publication content type may need a title, a body, a publication date, a PDF, and a cover graphic.

This extra data is stored in fields on the content type. Fields can be easily added, even by users with limited Drupal experience and no coding experience. This curriculum (see ladder) provides an overview of fields, and this lesson will discuss their basic components.

Fields are made up of the following components:

  • Inputs: Inputs are areas for content administrators to enter information as they add nodes with this content type. There are several types of inputs, including text, date, decimal, and list.
  • Labels: Labels let content administrators know what to enter in the field. If developers/site builders choose to display them, they can also be helpful for users visiting the site. Sometimes these labels are unnecessary for visitors -- for example, a date is usually clearly identifiable as a date -- and sometimes they're useful for gathering context.

Fields are added on the "Manage Fields" tab of a content type, accessible in Drupal 7 and Drupal 8 under Structure > Content types. Reorganizing them here by dragging and dropping will only affect what content administrators see as they add content.

The display of fields is controlled on the "Manage Display" tab of a content type. Reorganizing them here will affect what users see when they view a node. On this page, you can also choose which fields are displayed to visitors and which are hidden (visible only to administrators), which fields have visible labels, and what format they appear in.

In either the Manage Fields tab (for administrators) or the Manage Display tab (for visitors), related fields can be organized into groups for clear organization. These groups can be arranged so they appear in different vertical tabs when editing a node, if desired, for a cleaner admin experience. These features are useful for content types with many fields.

Once a field has been added to a content type, it is visible on that content type and also available to be referenced by views. For example, the cover graphic of a publication could be shown next to its title on a list of all the publications in the system.

To learn more, view the rest of the lessons on this ladder.