OREGON STATE UNIVERSITY

Defining Your Custom Node Type

 

All custom node types need to be defined.  What this means is that you must name the node type and provide Drupal some basic information about it.  This information is then included as administrative data on the Content Type manager.

So, let's create a Supplier custom content type.  This particular content type will be used to track and display supplier information.

To define our Supplier content type, do the following:

Go to Admin menu > Content management > Content types > Add content type.

You'll be presented with four different fieldsets on this screen.  The important thing to remember, when working with configurations, is that often times there is no "wrong" configuration.  The configuration of custom features, such as a custom content type, is up to the architect.  In this case, feel free to follow along, step-by-step, but understand that many of these settings can be changed as needed.

  • The Automatic title generation fieldset:
    • This is an advanced configuration that is discussed in depth in the Automatic Nodetitles article within this book.  We won't cover it in this example.
  • The Identification fieldset:
    • This information shows on the Content type manager administrative interface.  It's the list that is presented when you go to Admin menu > Content management > Content types.  This is also where you define the table name of the content type in the database.
      • In the Name field, enter Supplier
        • This should be "human-readable", which means you would enter the text in the format that a human being can easily read.
      • In the Type field, enter supplier
        • This should be "machine-readable", which means you need to enter the text in a very specific format. Use all lowercase, alpha-numeric characters.  Replace any spaces with underscores.
      • In the Description field, enter some information describing the node type.  For example, what purpose does it serve on the site?  You can use HTML in this text area.
  • The Submission form settings fieldset:
    • This is some default display information that will appear on the node submission form - the blank form that you see when you create a new piece of content.
      • In the Title field label field, enter Company Name.  This is the name of the field you wish to display to your user.  This is the standard Title field that shows in all node submission forms...the name that you put in this field only displays as a label.
      • In the Body field label field, enter Description.  This will change the label of the large Body text area that appears as a default for your use.  Similar to the Title field label, this changes only the label that is presented to your users.
        • Under different circumstances, you may not wish to use the Body field that is supplied as a default.  If this is the case, remove the title from the field and Drupal will then ignore the field.
      • Leave the Minimum number of words selection at 0.  This is used to force a user to type a meaningful amount of text in the field, versus something like a spam submission from a user.  This doesn't apply in our situation as our user list at OSU is very controlled.
      • In the Explanation or submission guidelines field, type Enter some description information about this supplier.  This field is used to help instruct your content author regarding the use of the content type.
  • The Workflow settings fieldset:
    • This fieldset contains configuration information related to how your content "behaves" when it's submitted.  For example, do you want it to publish automatically or save as a draft, when the content is submitted?
      • In the Default options, select Published.
        • The Promoted to front page option is generally used for a blog-style front page, which the OSU Drupal 6 installation does not, by default, use.  Most often, it's best to keep this option disabled.
        • The Sticky at top of Lists option is generally used for forum content, which is not included in the OSU Drupal 6 installation.  This option should typically be disabled.
        • The Create new revision option is a great option for content that requires automatic revision tracking, but we don't need it at this point so leave it disabled.
      • In the Multilingual support options, select Disabled.
        • Drupal is capable of providing a site that displays multiple languages.  This requires a great deal of set-up and authors who can create content in different languages, though, so we'll leave this disabled.
      • In the Attachments options, select Disabled.
        • This feature provides a file uploader that's used to upload and attach content to your node.  We won't be using it in this example so leave it disabled.  The Upload Path Settings fieldset is used by this feature to automaticlaly place files in pre-determined locations.  Since we have the uploader disabled, we do not need to set any upload path settings.

After all configurations are completed, click the Save content type button at the bottom of the screen.

definition screen for supplier content type

After saving your configurations, you will be redirected back to the Content type manager.

content type manager with supplier row added and confirmation message that supplier type has been added