Content Construction Kit

The Content Construction Kit, or CCK, provides a group of modules for Drupal 6 that help you add fields to nodes. Drupal 7 has a Fields module in core based on part of CCK. The Fields part is required by some other modules and slows down processing. There is a lot of tuning work performed on Drupal 7 to try and offset the Fields overhead because the Fields functionality is considered worth the work.

CCK adds overhead to your Drupal site because it stores field definitions in the database and page views require extra database reads to create a page. Anonymous visitors see mostly cached pages and CCK has little impact. Logged in visitors see freshly generated pages every page view and CCK slows down those page views. If one out of ten visitors logs in then one out of ten page views will suffer a performance hit. Among your anonymous visitors, there will be one slow page every few minutes when the page cache is rebuilt.

CCK used to be dramatically bad because CCK put every field in a different table then someone said Doh! Homer Simpson style and fixed the code. The new code is better. CCK is still one cause of random slowdowns where someone posts in a forum about a slow site and says it slowed down after I installed CCK then the CCK fanatics pile in with comments about about the problem not being CCK because site example.com uses CCK and has a gazillion visitors per second and every page is delivered in 0.0000 seconds. They do not mention that example.com uses a gazillion proxy servers to cache content in your local street and nobody is allowed to log in to see fresh content.

CCK is supposed to let non programmers create fields without programming but when you try to create useful new fields you end up having to write PHP code similar to what you would write without CCK. What really happens is CCK provides some common field types that non programmers can add to a content type. If none of those field types fit your requirement, you are stuck with hiring a programmer to add the field type the CCK way. The best long term approach would be to approach a CCK developer about adding your field type to CCK so that everybody can use it and share the maintenance workload.

+ Flexibility

- Processing overhead
- Programming still needed

Forms

You can build forms using CCK but you need additional modules for basic form creation. The following modules are included in CCK.

Content: This is the base module that has some permission settings.
Content Copy: Enables ability to import/export field definitions.
Content Permissions: Set field-level permissions for CCK fields.
Fieldgroup: Create display groups for CCK fields.
Node Reference: Defines a field type for referencing one node from another.
Number: Defines numeric field types.
Option Widgets: Defines selection, check box and radio button widgets for text and numeric fields.
Text: Defines simple text field types.
User Reference: Defines a field type for referencing a user from a node.

You will also need external modules for complex forms.

The Conditional Fields module drupal.org/project/conditional_fields, adds to CCK forms the important ability to make the appearance of a form section dependent on a previous field.

The Multistep module, drupal.org/project/multistep, adds multiple steps to CCK based forms and possibly is enough to make CCK based forms suitable for typical long forms.

The big test, my first form, requires multiple steps conditional on fields!

Configuration

The first module you install is Content which Allows administrators to define new content types. The only administration option is a permission to use PHP when defining fields. Select Administer » User management » Permissions to change the permissions. Select Administer » Content management » Content types to add fields to node content types. Under Operations, select Manage Fields. There is a list of the existing fields and no option to add new fields because there are no field types defined. You have to activate another module to define field types.

Activate module Text to Defines simple text field types then go back to manage fields. You now have an option to add a field of type text.

Activate module Number to Defines numeric field types. you can now select field types of Decimal, Float, and Integer.

Activate Option Widgets to Defines selection, check box and radio button widgets for text and numeric fields. There is no change to the list of field types in Manage fields. Instead the Widget drop down list expands to include radio and checkbox options.

Activate Fieldgroup to Create display groups for CCK fields. Manage fields now has an option to add a group as well as add a field.

Conclusion

Avoid CCK in Drupal 6 unless you have a very specific need. Use the Field module in Drupal 7 because it is already active and you do not add much additional overhead by adding an extra field to a node. CCK based forms are a pain for surveys and similar uses because of the need to add each form as a new content type.