Drupal - How to create new field type

When I did this a while ago I adapted the excellent field_example module from the Examples Module which is always the first place to look, as it has a lot of Drupal best practice in it.

As they say in the module comments:

     * Providing a field requires:
     * - Defining a field:
     *   - hook_field_info()
     *   - hook_field_schema()
     *   - hook_field_validate()
     *   - hook_field_is_empty()
     *
     * - Defining a formatter for the field (the portion that outputs the field for
     *   display):
     *   - hook_field_formatter_info()
     *   - hook_field_formatter_view()
     *
     * - Defining a widget for the edit form:
     *   - hook_field_widget_info()
     *   - hook_field_widget_form()

So, not for the faint hearted, but as others have said, all the information is there to get you started.

Tags:

Entities

7

Hooks