Fields

References

Fields have types, like List (text), Date, and Number (integer). There are some important types we haven’t talked about: references. References are fields that refer to other nodes.

BFF text field

Each sloth has a BFF. Just one BFF. They’re prickly about that. One and only one BFF.

Say you wanted to store that info.

Fields and data types

The Sloth content type in the previous lesson had fields for name, weight, and birth date. The fields hold different types of data. Names are text. Weights are numbers. Birth dates are, well, dates.

Drupal has lots of field types, to store whatever data you need. Modules add even more, like map coordinates. In this lesson, we’ll look at some of the most common field types.

Field types

When you create a new field, you get to select the field type:

Field types

Drupal core gives you 23 field types.

Content types

Earlier, the team decided that the IS needs three custom content types:

  • Person
  • Project
  • Event

Person

The team listed these fields:

  • Name
  • Phone (manager access only)
  • Email (manager access only)
  • Dues paid? (manager access only)
  • Affiliation (member, etc.) (manager access only)
  • Major
  • Projects
  • Notes (manager access only)

Each Person node has to have a title field. We’ll use that for Name, by giving the title field the label Name.

Content types

You can try the IS at http://gamerz.cybercour.se/. Go there now. Open it in a new browser window, side-by-side with the window you’re looking at now. Makes it easier to talk about.

You can hide the blocks on the right of this screen by clicking the – (minus) that’s near the top of the blocks on the right:

Hider

Also, try shrinking this window, and the exhibition system window. They can get quite narrow.

Opened the other window? Good.