Field Types API

Same name in other branches
  1. 9 core/modules/field/field.api.php \field_types
  2. 8.9.x core/modules/field/field.api.php \field_types
  3. 10 core/modules/field/field.api.php \field_types
  4. 11.x core/modules/field/field.api.php \field_types

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.

Parent topics

File

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

Functions

Title Sort descending File name Summary
hook_field_access modules/field/field.api.php Determine whether the user has access to a given field.
hook_field_delete modules/field/field.api.php Define custom delete behavior for this module's field data.
hook_field_delete_revision modules/field/field.api.php Define custom revision delete behavior for this module's field types.
hook_field_display_alter modules/field/field.api.php Alters the display settings of a field before it gets displayed.
hook_field_display_ENTITY_TYPE_alter modules/field/field.api.php Alters the display settings of a field on a given entity type before it gets displayed.
hook_field_extra_fields modules/field/field.api.php Exposes "pseudo-field" components on fieldable entities.
hook_field_extra_fields_alter modules/field/field.api.php Alter "pseudo-field" components on fieldable entities.
hook_field_extra_fields_display_alter modules/field/field.api.php Alters the display settings of pseudo-fields before an entity is displayed.
hook_field_formatter_settings_form modules/field_ui/field_ui.api.php Specify the form elements for a formatter's settings.
hook_field_formatter_settings_summary modules/field_ui/field_ui.api.php Return a short summary for the current formatter settings of an instance.
hook_field_info modules/field/field.api.php Define Field API field types.
hook_field_info_alter modules/field/field.api.php Perform alterations on Field API field types.
hook_field_insert modules/field/field.api.php Define custom insert behavior for this module's field data.
hook_field_instance_settings_form modules/field_ui/field_ui.api.php Add settings to an instance field settings form.
hook_field_is_empty modules/field/field.api.php Define what constitutes an empty item for a field type.
hook_field_load modules/field/field.api.php Define custom load behavior for this module's field types.
hook_field_prepare_translation modules/field/field.api.php Define custom prepare_translation behavior for this module's field types.
hook_field_prepare_view modules/field/field.api.php Prepare field values prior to display.
hook_field_presave modules/field/field.api.php Define custom presave behavior for this module's field types.
hook_field_schema modules/field/field.api.php Define the Field API schema for a field structure.
hook_field_settings_form modules/field_ui/field_ui.api.php Add settings to a field settings form.
hook_field_storage_update_field modules/field/field.api.php Update the storage information for a field.
hook_field_update modules/field/field.api.php Define custom update behavior for this module's field data.
hook_field_validate modules/field/field.api.php Validate this module's field data.
hook_field_widget_settings_form modules/field_ui/field_ui.api.php Add settings to a widget settings form.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.