Before rushing headlong into creating a custom content type, it’s a good idea to have a little bit of a plan sketched out ahead of time.

The Fields module isn’t typically intended for items of a singular nature. It’s generally meant for content that has a format to it – items that possess similar types of information and need to look consistent in a group of similar content.  We call these items data objects.  Data objects have particular, common attributes about them.  It's those attributes that we want to recognize and define here.

We'll use the object "car" as our data object...

Determine Fields

So let's start by determining some fields that will contain information that describes our car.  Put yourself into a scenario where you're looking for a new car - what are some of the different things you would like to know about a car before you go to look at it?

  • Cost
  • Year
  • Make
  • Model
  • Body Type
  • Color
  • Picture
  • Description
  • Options

These are all reasonable car-related fields that you would find on any form that gathers information about automobiles.

Should Fields Be Required or Optional?

Now that we have a list of fields, we need to determine which of these field items require some type of value to be entered into them.  What we're determining here is whether or not a user has to enter data into a field before saving it.

Here's where a table comes in handy.  You may want to start building one...

Required Optional
 Cost  Picture
 Year  Description
 Make  Options
 Body Type  

How do we determine what fields are required or not?

It's actually pretty simple.  There are a few questions you can ask yourself to help gauge this:

  • Is the data something that you would reasonably expect someone to know, given the object? 
    • For example, if a person were selling a car, that person should be able to tell you how much the cost is, what the color is, etc.
  • Is there a chance a user may not be able to provide the data? 
    • Perhaps the user doesn't have a picture of the car at the time that it's being posted on-line for sale.  Should this disallow the user from making a post, in general?
  • Is the information "extra detail"?
    • Is this extra information that an audience may be interested in knowing, but it isn't critical?

Determining Data Types

Now that we know what fields we want on our content type form, we should consider what data types these fields will hold.

A data type is a set of data values that possess predefined characteristics.  Following are some common data types that you may be familiar with:

  • Text
  • Number
  • Image

So, now we should refine our data field list a bit more by including the type of data that will be involved with each field:

Required Optional
 Cost - Number  Picture - File/Image
 Year - Date  Description - Long Text
 Make - Select List  Options - Select List
 Model - Text  
 Body Type - Select List  
 Color - Select List  

That was pretty easy, right?

Now it's just a matter of defining a node type, adding the fields we have in our table, and configuring them to behave the way we want them to behave.