Field API
Attach custom data fields to Drupal objects.
The Field API allows custom data fields to be attached to Drupal objects and takes care of storing, loading, editing, and rendering field data. Any object 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.
- Field Types API. Defines field types, widget types, and display formatters. Field modules use this API to provide field types like Text and Node Reference along with the associated form elements and display formatters.
- Field CRUD API. Create, updates, and deletes fields, bundles (a.k.a. "content types"), and instances. Modules use this API, often in hook_install(), to create custom data structures.
- Field Attach API. Connects object types to the Field API. Field Attach API functions load, store, generate Form API structures, display, and perform a variety of other functions for field data connected to individual objects. Fieldable object types like node and user use this API to make themselves fieldable.
- Field Info API. Exposes information about all fields, instances, widgets, and related information defined by or with the Field API.
- Field Storage API. Provides a pluggable back-end storage system for actual field data. The default implementation, field_sql_storage.module, stores field data in the local SQL database.
- Field API bulk data deletion. Cleans up after bulk deletion operations such as field_delete_field() and field_delete_instance().
Constants
| Name | Location | Description |
|---|---|---|
| FIELD_BEHAVIOR_CUSTOM | modules/field/field.module | TODO |
| FIELD_BEHAVIOR_DEFAULT | modules/field/field.module | TODO |
| FIELD_BEHAVIOR_NONE | modules/field/field.module | TODO |
| FIELD_CARDINALITY_UNLIMITED | modules/field/field.module | Value for $field['cardinality'] property to indicate it can hold an unlimited number of values. |
| FIELD_LANGUAGE_NONE | modules/field/field.module | The language code assigned to untranslatable fields. |
| FIELD_LOAD_CURRENT | modules/field/field.module | Age argument for loading the most recent version of an object's field data with field_attach_load(). |
| FIELD_LOAD_REVISION | modules/field/field.module | Age argument for loading the version of an object's field data specified in the object with field_attach_load(). |
| FIELD_QUERY_COMPLETE | modules/field/field.module | Cursor return value for field_attach_query() to indicate that no more data is available. |
| FIELD_QUERY_NO_LIMIT | modules/field/field.module | Limit argument for field_attach_query() to request all available objects instead of a limited number. |
Functions
| Name | Location | Description |
|---|---|---|
| field_access | modules/field/field.module | Determine whether the user has access to a given field. |
| field_associate_fields | modules/field/field.module | Allows a module to update the database for fields and columns it controls. |
| field_build_modes | modules/field/field.module | Registry of available build modes. |
| field_cache_clear | modules/field/field.module | Clear the field info and field date caches. |
| field_cron | modules/field/field.module | Implement hook_cron(). |
| field_extract_bundle | modules/field/field.module | Helper function to extract the bundle name of from a bundle object. |
| field_extra_fields | modules/field/field.module | Registry of pseudo-field components in a given bundle. |
| field_filter_xss | modules/field/field.module | Like filter_xss_admin(), but with a shorter list of allowed tags. |
| field_flush_caches | modules/field/field.module | Implement hook_flush_caches. |
| field_format | modules/field/field.module | Format a field item for display. |
| field_get_default_value | modules/field/field.module | Helper function to get the default value for a field on an object. |
| field_has_data | modules/field/field.module | Determine whether a field has any data. |
| field_help | modules/field/field.module | Implement hook_help(). |
| field_modules_disabled | modules/field/field.module | Implement hook_modules_disabled(). |
| field_modules_enabled | modules/field/field.module | Implement hook_modules_enabled(). |
| field_modules_installed | modules/field/field.module | Implement hook_modules_installed(). |
| field_modules_uninstalled | modules/field/field.module | Implement hook_modules_uninstalled(). |
| field_set_empty | modules/field/field.module | Helper function to filter out empty values. |
| field_theme | modules/field/field.module | Implement hook_theme(). |
| field_view_field | modules/field/field.module | Return a single field, fully themed with label and multiple values. |
| template_preprocess_field | modules/field/field.module | Theme preprocess function for field.tpl.php. |
| template_process_field | modules/field/field.module | Theme process function for field.tpl.php. |
| _field_extra_weights_pre_render | modules/field/field.module | Pre-render callback to adjust weights of non-field elements on objects. |
| _field_filter_xss_allowed_tags | modules/field/field.module | List of tags allowed by field_filter_xss(). |
| _field_filter_xss_display_allowed_tags | modules/field/field.module | Human-readable list of allowed tags, for display in help texts. |
| _field_sort_items | modules/field/field.module | Helper function to sort items in a field according to user drag-n-drop reordering. |
| _field_sort_items_helper | modules/field/field.module | Sort function for items order. (copied form element_sort(), which acts on #weight keys) |
| _field_sort_items_value_helper | modules/field/field.module | Same as above, using ['_weight']['#value'] |
