Field API

  1. drupal
    1. drupal7

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. The Content Construction Kit user-interface module uses this API for its major functionality.
  • Field Attach API. Connects object types to the Field API. Field Attach API functions load, store, generate Form API structures, display, and perform a vareity 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.

Klassen

NameBeschreibung
FieldExceptionBase class for all exceptions thrown by Field API functions.

Funktionen & Methoden

NameBeschreibung
field_accessDetermine whether the user has access to a given field.
field_associate_fieldsAllows a module to update the database for fields and columns it controls.
field_build_modesRegistry of available build modes. TODO : move into hook_fieldable_info() ?
field_cache_clearClear the cached information; called in several places when field information is changed.
field_filter_xssLike filter_xss_admin(), but with a shorter list of allowed tags.
field_flush_cachesImplementation of hook_flush_caches.
field_formatFormat a field item for display.
field_helpImplementation of hook_help().
field_initImplementation of hook_init().
field_menuImplementation of hook_menu().
field_modules_disabledImplementation of hook_modules_disabled().
field_modules_enabledImplementation of hook_modules_enabled().
field_modules_installedImplementation of hook_modules_installed().
field_modules_uninstalledImplementation of hook_modules_uninstalled().
field_set_emptyHelper function to filter out empty values.
field_themeImplementation of hook_theme().
field_view_fieldReturn a single field, fully themed with label and multiple values.
template_preprocess_fieldTheme preprocess function for field.tpl.php.
_field_filter_xss_allowed_tagsList of tags allowed by field_filter_xss().
_field_filter_xss_display_allowed_tagsHuman-readable list of allowed tags, for display in help texts.
_field_sort_itemsHelper function to sort items in a field according to user drag-n-drop reordering.
_field_sort_items_helperSort function for items order. (copied form element_sort(), which acts on #weight keys)
_field_sort_items_value_helperSame as above, using ['_weight']['#value']

Konstanten

NameBeschreibung
FIELD_BEHAVIOR_CUSTOMTODO
FIELD_BEHAVIOR_DEFAULTTODO
FIELD_BEHAVIOR_NONETODO
FIELD_CARDINALITY_UNLIMITEDValue for $field['cardinality'] property to indicate it can hold an unlimited number of values.
FIELD_LOAD_CURRENTAge argument for loading the most recent version of an object's field data with field_attach_load().
FIELD_LOAD_REVISIONAge argument for loading the version of an object's field data specified in the object with field_attach_load().

modules/field/field.module, line 8

Kommentare

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen

Kommentar hinzufügen

Der Inhalt dieses Feldes wird nicht öffentlich zugänglich angezeigt.
  • Internet- und E-Mail-Adressen werden automatisch umgewandelt.
  • Zulässige HTML-Tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Zeilen und Absätze werden automatisch erzeugt.

Weitere Informationen über Formatierungsoptionen