LevelTen Web Design | Dallas, TX

Drupal 5

When the fields are added via CCK, do we need to create columns manually

No, one of the benefits of the CCK is that it manages the dabase tables for you including table creation and collumn management. When you add a new field via cck, it automatically generates one or more collumns, depending on the field type you selected. Those collumns will get added to a table called "content_type_[contentTypeMachineName]".

If you have multiple content types and wish to add similarly named fields for each, there are two items to look out for. When creating a field of the same name on two different content types you have two options:
1. Add exiting field

Drupal node module skeleton

Recipe for creating a node module skeleton:
1. Create three files using the code snippets at the bottom of this post

  • foo.info
  • foo.module
  • foo.theme

Note: replace foo with your module name. If this is for a specific project, use project codes in the format [pc][nodetype]

2. do the following search and replace on all three files
"[pc]foo" -> [pc][nodetype]
"foo" -> [nodetype]

foo.info code:

  1. ; $Id $
  2. name = "Foo"
  3. description = "Foo posts."
  4. package =
  5. dependencies =

foo.module code:

Syndicate content