Voting starts in March for the Drupal Association Board election.
NOTE: This page is still very much under construction and prone to blatant errors.. I'm filling stuff in as I figure it out. -- webchick
CCK is comprised of 2 things:
- fields: These refer to the data that's being stored. For example, Text or Number.
- widgets: These refer to how the input widget an end user uses to enter the data looks. For example, Text field or Check boxes.
CCK's data model consists of 3 base tables:
- node_type_content: A table containing the CCK node type defninitions: name, label, description, help, and the label given to the node's Title field.
- node_field: A table containing the various field definitions: field name, type, and various settings.
- node_field_instance: An individual instance of a field applied to a content type, along with its widget settings. For example, field_description in the content_blog type and field_description in the content_product type.
In addition, each new content type creates its own table, called node_content_X, where X is the name of the content type. This table contains a node ID (nid) and revision ID (vid) field, along with the values of any extra fields, if the field is specific to that content type.
If, however, a field is shared among more than one content type, a table called node_data_field_X, where X is the name of the field, is also created to track the field's settings between node types.
Note: More detailed hook information is available from the file field.php in the CCK module.
- hook_field_info(): Here you declare the label for your field type(s). This will show up when you click "add field" on a CCK content type.
- hook_field_settings($op, $field): Handles displaying, validating, and saving field settings forms. In addition, manages how they're stored in the database and provides Views integration.
- hook_field($op, &$node, $field, &$node_field, $teaser, $page): Define the behavior of a field type.
- hook_field_formatter_info(): Declare information about a formatter.
- hook_field_formatter($field, $item, $formatter, $node): Prepare an individual item for viewing in a browser.
- hook_widget_info(): Here you declare any widgets associated with your field type. These will show up below the fields when you click "add field" on a CCK content type in 4.7.x and 5.x. Fields show up in the first drop-down and widgets in the second drop down when adding content types in 6.x.
- hook_widget_settings($op, $widget): Handle the parameters for a widget.
- hook_widget: Define the behavior of a widget.
- While developing CCK, you may notice oddities such as settings you made not appearing and other such things. Always remember to clear your cache!