Content types and users

The key to this project is making the right entities. An entity is something the business wants to store data about. Products, customers, stores… these are typical entities.

Drupal can work with many different entities, but let’s just talk about two:

  • Content types
  • Users

Each one has fields. A field is a property of the entity. For example, the content type Basic page has the fields Title and Body, among others. When you edit a Basic page, you work with the fields. This will be familiar:

Basic page edit form

Drupal creates the Basic page content type for you, and adds the Title and Body. You can add other fields, if you like, such as a field for attaching files to a basic page.

Users are entities, too. Drupal gives user entities usernames, passwords, email addresses, roles, and others. You’ve worked with them before, on the user edit form:

User edit form

You can add your own custom fields to the user entity, such as phone number, date of birth, and biography.

Here are some different things mentioned in the requirements.

  • Exhibit
  • Exhibitor
  • Table
  • Door prize
  • Parking
  • Visitor
  • Exhibition management
  • City government
  • Press

We can decide what each thing is: a content type, a user, a field, or something else. Here’s what we’ll do for the exhibit site:

  • Exhibit – content type
  • Exhibitor – user with a special role
  • Room an exhibit is in – field of the Exhibit content type
  • Table an exhibit is on (a number, like table 15) – field of the Exhibit content type
  • Door prize – content type
  • Parking – text/image on a page
  • Visitor – not represented on the site
  • Exhibition management – user (just one – Sylvia)
  • City government – not represented on the site
  • Press – not represented on the site (though there is info for them to use)

For this project, we’d create two new content types:

  • Exhibit
  • Door prize

Exhibitors have to be Drupal users, so they can edit their own data. We can add fields to the user entity to capture extra data we need about exhibitors. We can make an exhibitor role, and use it to set permissions, as we did earlier. We can give users with the exhibitor role permission to edit their own exhibit pages, and nothing else.

(You can’t be expected to figure this out by yourself. It takes more expertise than you’ll get in this course. When you get a project with content types, this information will be given to you.)