Attaches 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'.
Name | Location | Description |
---|---|---|
_field_sort_items_value_helper |
drupal/ |
Callback for usort() within theme_field_multiple_value_form(). |
_field_sort_items_helper |
drupal/ |
Callback for usort() within _field_sort_items(). |
_field_sort_items |
drupal/ |
Sorts items in a field according to user drag-and-drop reordering. |
_field_filter_xss_display_allowed_tags |
drupal/ |
Returns a human-readable list of allowed tags for display in help texts. |
_field_filter_xss_allowed_tags |
drupal/ |
Returns a list of tags allowed by field_filter_xss(). |
_field_filter_items |
drupal/ |
Filters out empty field values. |
template_process_field |
drupal/ |
Theme process function for theme_field() and field.html.twig. |
template_preprocess_field |
drupal/ |
Prepares variables for field templates. |
field_view_value |
drupal/ |
Returns a renderable array for a single field value. |
field_view_mode_settings |
drupal/ |
Returns view mode settings in a given bundle. |
field_view_field |
drupal/ |
Returns a renderable array for the value of a single field in an entity. |
field_ui_instance_load |
drupal/ |
Menu loader callback: Loads a field instance based on field and bundle name. |
field_theme |
drupal/ |
Implements hook_theme(). |
field_system_info_alter |
drupal/ |
Implements hook_system_info_alter(). |
field_sync_field_status |
drupal/ |
Refreshes the 'active' and 'storage[active]' values for fields. |
field_rebuild |
drupal/ |
Implements hook_rebuild(). |
field_populate_default_values |
drupal/ |
Inserts a default value for each entity field not having one. |
field_page_build |
drupal/ |
Implements hook_page_build(). |
field_modules_enabled |
drupal/ |
Implements hook_modules_enabled(). |
field_modules_disabled |
drupal/ |
Implements hook_modules_disabled(). |
field_language_fallback |
drupal/ |
Applies language fallback rules to the fields attached to the given entity. |
field_help |
drupal/ |
Implements hook_help(). |
field_has_data |
drupal/ |
Determines whether a field has any data. |
field_get_items |
drupal/ |
Returns the field items in the language they currently would be displayed. |
field_get_default_value |
drupal/ |
Helper function to get the default value for a field on an entity. |
field_filter_xss |
drupal/ |
Filters an HTML string to prevent cross-site-scripting (XSS) vulnerabilities. |
field_field_widget_info_alter |
drupal/ |
Implements hook_field_widget_info_alter(). |
field_extract_bundle |
drupal/ |
Extracts the bundle name from a bundle object. |
field_entity_field_info |
drupal/ |
Implements hook_entity_field_info() to define all configured fields. |
field_entity_create |
drupal/ |
Implements hook_entity_create(). |
field_data_type_info |
drupal/ |
Implements hook_data_type_info() to register data types for all field types. |
field_cron |
drupal/ |
Implements hook_cron(). |
field_cache_clear |
drupal/ |
Clears the field info and field data caches. |
field_bundle_settings |
drupal/ |
Gets or sets administratively defined bundle settings. |
field_access |
drupal/ |
Determines whether the user has access to a given field. |
Name | Location | Description |
---|---|---|
FIELD_LOAD_REVISION |
drupal/ |
Load the version of an entity's field data specified in the entity. |
FIELD_LOAD_CURRENT |
drupal/ |
Load the most recent version of an entity's field data. |
FIELD_CARDINALITY_UNLIMITED |
drupal/ |
Value for field API indicating a field accepts an unlimited number of values. |
FIELD_BEHAVIOR_NONE |
drupal/ |
Value for field API indicating a widget doesn't accept default values. |
FIELD_BEHAVIOR_DEFAULT |
drupal/ |
Value for field API concerning widget default and multiple value settings. |
FIELD_BEHAVIOR_CUSTOM |
drupal/ |
Value for field API indicating a widget can receive several field values. |