Field Types API

Define field types.

In the Field API, each field has a type, which determines what kind of data (integer, string, date, etc.) the field can hold, which settings it provides, and so on. The data type(s) accepted by a field are defined in hook_field_schema(); other basic properties of a field are defined in hook_field_info(). The other hooks below are called by the Field Attach API to perform field-type-specific actions.

The Field Types API also defines two kinds of pluggable handlers: widgets and formatters. Widgets specify how the field appears in edit forms, while formatters specify how the field appears in displayed entities.

A third kind of pluggable handlers, storage backends, is defined by the Field Storage API.

See Field API for information about the other parts of the Field API.

Functions & methods

NameLocationDescription
hook_field_deletemodules/field/field.api.phpDefine custom delete behavior for this module's field data.
hook_field_delete_revisionmodules/field/field.api.phpDefine custom revision delete behavior for this module's field types.
hook_field_formatter_settings_formmodules/field_ui/field_ui.api.phpSpecify the form elements for a formatter's settings.
hook_field_formatter_settings_summarymodules/field_ui/field_ui.api.phpReturn a short summary for the current formatter settings of an instance.
hook_field_infomodules/field/field.api.phpDefine Field API field types.
hook_field_info_altermodules/field/field.api.phpPerform alterations on Field API field types.
hook_field_insertmodules/field/field.api.phpDefine custom insert behavior for this module's field data.
hook_field_instance_settings_formmodules/field_ui/field_ui.api.phpAdd settings to an instance field settings form.
hook_field_is_emptymodules/field/field.api.phpDefine what constitutes an empty item for a field type.
hook_field_loadmodules/field/field.api.phpDefine custom load behavior for this module's field types.
hook_field_prepare_translationmodules/field/field.api.phpDefine custom prepare_translation behavior for this module's field types.
hook_field_prepare_viewmodules/field/field.api.phpPrepare field values prior to display.
hook_field_presavemodules/field/field.api.phpDefine custom presave behavior for this module's field types.
hook_field_schemamodules/field/field.api.phpDefine the Field API schema for a field structure.
hook_field_settings_formmodules/field_ui/field_ui.api.phpAdd settings to a field settings form.
hook_field_storage_update_fieldmodules/field/field.api.phpUpdate the storage information for a field.
hook_field_updatemodules/field/field.api.phpDefine custom update behavior for this module's field data.
hook_field_validatemodules/field/field.api.phpValidate this module's field data.
hook_field_widget_settings_formmodules/field_ui/field_ui.api.phpAdd settings to a widget settings form.

File

modules/field/field.api.php, line 83