function field_get_items
Returns the field items in the language they currently would be displayed.
Parameters
$entity_type: The type of $entity; e.g., 'node' or 'user'.
$entity: The entity containing the data to be displayed.
$field_name: The field to be displayed.
$langcode: (optional) The language code $entity->{$field_name} has to be displayed in. Defaults to the current language.
Return value
An array of field items keyed by delta if available, FALSE otherwise.
Related topics
7 calls to field_get_items()
- comment_admin_overview in modules/
comment/ comment.admin.inc - Form builder for the comment overview administration form.
- comment_preview in modules/
comment/ comment.module - Generate a comment preview.
- comment_tokens in modules/
comment/ comment.tokens.inc - Implements hook_tokens().
- file_file_download in modules/
file/ file.module - Implements hook_file_download().
- ImageStylesHTTPHeadersTestCase::_testImageStyleUrlAndPath in modules/
image/ image.test - Function to scale and test.
File
-
modules/
field/ field.module, line 940
Code
function field_get_items($entity_type, $entity, $field_name, $langcode = NULL) {
$langcode = field_language($entity_type, $entity, $field_name, $langcode);
return isset($entity->{$field_name}[$langcode]) ? $entity->{$field_name}[$langcode] : FALSE;
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.