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. So the field will be called Title in the guts of Drupal, but called Name when shown to the user.

You set that up when creating or editing the content type:

Setting title field's label

Here is someone entering a new person:

Creating a person

The Title field has the label Name.

Phone and email both have special field types. Just select them. Single valued, no defaults, not required.

Dues paid can be a List (text) with the values Yes and No. The default should be No. Single valued, no defaults, not required.

The team made affiliation a List (text), with the values President, Secretary, Treasurer, Member, Advisor, Speaker, and Other. They could have used a taxonomy, but decided that the values were unlikely to change. Multivalued, no defaults, not required.

The next field is Majors, like Art, Computer Science, Business, etc. This list could change. The university has dozens of majors, with new ones being added every year. The team created a taxonomy called Majors, and set it up so that users could add new values. They added a reference field called Majors to the Person content type, with the Autocomplete (Tag style) input widget. Multivalued, no defaults, not required.

The next field is Projects, that is, the projects the person is working on. Reference to the Project content type. That type doesn’t exist yet, so the team can’t create a field referencing it. They’ll have to come back to this one.

The last field is Notes. They could have reused the Body field, but decided that they didn’t need the summary part of it. They deleted the Body field that Drupal created for them, and added a new Text (long, formatted) field. Single valued, no defaults, not required.

Recall that there are a few different tabs when defining a content type:

  • Manage fields list the fields and their types.
  • Manage form display shows the order of the fields on the node edit screen, and the widget types.
  • Manage display shows how node pages will look.

Here’s what all three looked like for people, once the Projects field had been added.

Manage fields

Manage form display

Manage display

Project

The Project content type is simpler. Here’s what they decided earlier:

  • Name
  • Coordinator, the human coordinating the project
  • Homepage (a URL)
  • Description

Here are it’s three tabs:

Manage fields

Coordinator references a person. Just one. For Description, the team used the Body field, and just changed its label.

Manage form

Manage display

Event

Here’s what the team decided earlier for event:

  • Title
  • When
  • Where
  • Description
  • Speakers

Speakers is a reference into Person. Multivalued.

Event fields

Event form

Event display

Exercise

Exercise: Your gamerz: content types
Make person, project, and event content types for your gamerz IS.

Submit the URL of your site, and the login credentials for user 1.

(If you were logged in as a student, you could submit an exercise solution, and get some feedback.)

Summary

We have three content types: Person, Project, and Event.