Drupal 5

ReferralField - Part Three - Formatters and Presenting Output

In Part three of our CCK field widget tutorial, we will finish our skeleton module and create our default formatter. Implementing a Formatter requires implementing hook_field_formatter_info(), hook_field_formatter, and usually a theme callback, so theme developers can override the HTML output of the formatter if necessary.

Like our previous info hooks, this hook returns a simple array, keyed on the machine readable name of the formatter and has an internal array of the fields the formatter can be applied to.


ReferralField - Part Two - Widgets and Collecting Input

Now that we've defined our Data Layer with the field hooks we can move on to widgetry. We're only going to assemble one widget for this part, the manual input widget. We will cover advanced widgets in Part 4. We've got three hooks to work with again hook_widget_info, hook_widget_settings, and hook_widget.

You do not have to implement widgets with your field module, but you should probably provide at least one widget by default.


ReferralField - Part One - Field Hooks and the Data Layer

We begin our Journey in to CCK 1.x Wonderland by defining a field. Developing a CCK Field requires working with three systems of hooks: Fields(Data Model), Widgets(User Interfaces/Field Input), and Formatters(Ouput).

We're going to start with Field hooks, since they let CCK know we offer a field.

This hook lists the fieldtypes implemented in our module. It returns an associative array of machine readable names and human readable labels for each of the field types implemented in the module.

* Implementation of hook_field_info().

Create a Basic CCK field - ReferralField

Welcome to my first tutorial. I hope you can follow along. This tutorial walks you through the basics of creating a CCK field type. This tutorial will target Drupal 5.x.

For those who don't know, CCK is Drupal's Content Construction Kit.
CCK allows you to create custom node types and extend existing node types with custom fields. These custom fields are the building block of complex content types and encapsulate handling for complex data types.

Subscribe to RSS - Drupal 5