Attach custom data fields to Drupal entities.
The Field API allows custom data fields to be attached to Drupal entities and takes care of storing, loading, editing, and rendering field data. Any entity type (node, user, etc.) can use the Field API to make itself "fieldable" and thus allow fields to be attached to it. Other modules can provide a user interface for managing custom fields via a web browser as well as a wide and flexible variety of data type, form element, and display format capabilities.
The Field API defines two primary data structures, Field and Instance, and the concept of a Bundle. A Field defines a particular type of data that can be attached to entities. A Field Instance is a Field attached to a single Bundle. A Bundle is a set of fields that are treated as a group by the Field Attach API and is related to a single fieldable entity type.
For example, suppose a site administrator wants Article nodes to have a subtitle and photo. Using the Field API or Field UI module, the administrator creates a field named 'subtitle' of type 'text' and a field named 'photo' of type 'image'. The administrator (again, via a UI) creates two Field Instances, one attaching the field 'subtitle' to the 'node' bundle 'article' and one attaching the field 'photo' to the 'node' bundle 'article'. When the node system uses the Field Attach API to load all fields for an Article node, it passes the node's entity type (which is 'node') and content type (which is 'article') as the node's bundle. field_attach_load() then loads the 'subtitle' and 'photo' fields because they are both attached to the 'node' bundle 'article'.
Field definitions are represented as an array of key/value pairs.
Field instance definitions are represented as an array of key/value pairs.
Bundles are represented by two strings, an entity type and a bundle name.
|FieldUpdateForbiddenException||Exception class thrown by hook_field_update_forbid().|
|field_access||Determine whether the user has access to a given field.|
|field_associate_fields||Allows a module to update the database for fields and columns it controls.|
|field_bundle_settings||Gets or sets administratively defined bundle settings.|
|field_cache_clear||Clear the field info and field data caches.|
|field_extract_bundle||Helper function to extract the bundle name of from a bundle object.|
|field_extra_fields_get_display||Returns the display settings to use for pseudo-fields in a given view mode.|
|field_filter_xss||Like filter_xss_admin(), but with a shorter list of allowed tags.|
|field_get_default_value||Helper function to get the default value for a field on an entity.|
|field_get_display||Returns the display settings to use for an instance in a given view mode.|
|field_get_items||Returns the field items in the language they currently would be displayed.|
|field_has_data||Determine whether a field has any data.|
|field_sync_field_status||Refreshes the 'active' and 'storage_active' columns for fields.|
|field_view_field||Returns a renderable array for the value of a single field in an entity.|
|field_view_mode_settings||Returns view mode settings in a given bundle.|
|field_view_value||Returns a renderable array for a single field value.|
|template_preprocess_field||Theme preprocess function for theme_field() and field.tpl.php.|
|template_process_field||Theme process function for theme_field() and field.tpl.php.|
|_field_extra_fields_pre_render||Pre-render callback to adjust weights and visibility of non-field elements.|
|_field_filter_items||Helper function to filter out empty field values.|
|_field_filter_xss_allowed_tags||List of tags allowed by field_filter_xss().|
|_field_filter_xss_display_allowed_tags||Human-readable list of allowed tags, for display in help texts.|
|_field_sort_items||Helper function to sort items in a field according to user drag-n-drop reordering.|
|_field_sort_items_helper||Sort function for items order. (copied form element_sort(), which acts on #weight keys)|
|_field_sort_items_value_helper||Same as above, using ['_weight']['#value']|
|FIELD_BEHAVIOR_CUSTOM||Value for field API indicating a widget can receive several field values.|
|FIELD_BEHAVIOR_DEFAULT||Value for field API concerning widget default and multiple value settings.|
|FIELD_BEHAVIOR_NONE||Value for field API indicating a widget doesn't accept default values.|
|FIELD_CARDINALITY_UNLIMITED||Value for field API indicating a field accepts an unlimited number of values.|
|FIELD_LOAD_CURRENT||Age argument for loading the most recent version of an entity's field data with field_attach_load().|
|FIELD_LOAD_REVISION||Age argument for loading the version of an entity's field data specified in the entity with field_attach_load().|