Commit 3756cdd8 authored by webchick's avatar webchick

#707724 follow-up by yched: More Field API/Entity API terminology clean-up.

parent 7562a8ef
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -32,7 +32,7 @@ function field_default_extract_form_values($entity_type, $entity, $field, $insta
* @param $entity_type
* The type of $entity.
* @param $entity
* The object for the operation.
* The entity for the operation.
* @param $field
* The field structure for the operation.
* @param $instance
......@@ -43,7 +43,7 @@ function field_default_extract_form_values($entity_type, $entity, $field, $insta
* $entity->{$field['field_name']}[$langcode], or an empty array if unset.
* @param $errors
* The array of errors, keyed by field name and by value delta, that have
* already been reported for the object. The function should add its errors
* already been reported for the entity. The function should add its errors
* to this array. Each error is an associative array, with the following
* keys and values:
* - 'error': an error code (should be a string, prefixed with the module name)
......@@ -102,16 +102,16 @@ function field_default_insert($entity_type, $entity, $field, $instance, $langcod
* @param $entity_type
* The type of $entity; e.g. 'node' or 'user'.
* @param $entities
* An array of objects being displayed, keyed by object id.
* An array of entities being displayed, keyed by entity id.
* @param $field
* The field structure for the operation.
* @param $instances
* Array of instance structures for $field for each object, keyed by object
* Array of instance structures for $field for each entity, keyed by entity
* id.
* @param $langcode
* The language associated to $items.
* @param $items
* Array of field values already loaded for the objects, keyed by object id.
* Array of field values already loaded for the entities, keyed by entity id.
* @param $display
* Can be either:
* - the name of a view mode
......@@ -119,14 +119,14 @@ function field_default_insert($entity_type, $entity, $field, $instance, $langcod
* 'display' entry of $instance definitions.
*/
function field_default_prepare_view($entity_type, $entities, $field, $instances, $langcode, &$items, $display) {
// Group objects, instances and items by formatter module.
// Group entities, instances and items by formatter module.
$modules = array();
foreach ($instances as $id => $instance) {
$display = is_string($display) ? $instance['display'][$display] : $display;
if ($display['type'] !== 'hidden') {
$module = $display['module'];
$modules[$module] = $module;
$grouped_objects[$module][$id] = $entities[$id];
$grouped_entities[$module][$id] = $entities[$id];
$grouped_instances[$module][$id] = $instance;
$grouped_displays[$module][$id] = $display;
// hook_field_formatter_prepare_view() alters $items by reference.
......@@ -138,7 +138,7 @@ function field_default_prepare_view($entity_type, $entities, $field, $instances,
// Invoke hook_field_formatter_prepare_view().
$function = $module . '_field_formatter_prepare_view';
if (function_exists($function)) {
$function($entity_type, $grouped_objects[$module], $field, $grouped_instances[$module], $langcode, $grouped_items[$module], $grouped_displays[$module]);
$function($entity_type, $grouped_entities[$module], $field, $grouped_instances[$module], $langcode, $grouped_items[$module], $grouped_displays[$module]);
}
}
}
......@@ -149,16 +149,16 @@ function field_default_prepare_view($entity_type, $entities, $field, $instances,
* @param $entity_type
* The type of $entity; e.g. 'node' or 'user'.
* @param $entities
* An array of objects being displayed, keyed by object id.
* An array of entities being displayed, keyed by entity id.
* @param $field
* The field structure for the operation.
* @param $instances
* Array of instance structures for $field for each object, keyed by object
* Array of instance structures for $field for each entity, keyed by entity
* id.
* @param $langcode
* The language associated to $items.
* @param $items
* Array of field values already loaded for the objects, keyed by object id.
* Array of field values already loaded for the entities, keyed by entity id.
* @param $display
* Can be either:
* - the name of a view mode;
......
......@@ -10,7 +10,7 @@
* Create a separate form element for each field.
*/
function field_default_form($entity_type, $entity, $field, $instance, $langcode, $items, &$form, &$form_state, $get_delta = NULL) {
// This could be called with no object, as when a UI module creates a
// This could be called with no entity, as when a UI module creates a
// dummy form to set default values.
if ($entity) {
list($id, , ) = entity_extract_ids($entity_type, $entity);
......@@ -29,7 +29,7 @@ function field_default_form($entity_type, $entity, $field, $instance, $langcode,
'errors' => array(),
);
// Populate widgets with default values when creating a new object.
// Populate widgets with default values when creating a new entity.
if (empty($items) && empty($id)) {
$items = field_get_default_value($entity_type, $entity, $field, $instance, $langcode);
}
......
; $Id$
name = Field
description = Field API to add fields to objects like nodes and users.
description = Field API to add fields to entities like nodes and users.
package = Core - fields
version = VERSION
core = 7.x
......
......@@ -168,7 +168,7 @@ function _field_info_collate_types($reset = FALSE) {
* - fields_id: Array of existing fields, keyed by field id. This entry lists
* both deleted and non-deleted fields. The bundles element is the same as
* for 'fields'.
* - instances: Array of existing instances, keyed by object type, bundle
* - instances: Array of existing instances, keyed by entity type, bundle
* name and field name. This entry only lists non-deleted instances.
*/
function _field_info_collate_fields($reset = FALSE) {
......@@ -482,12 +482,12 @@ function field_info_storage_types($storage_type = NULL) {
* Returns information about existing bundles.
*
* @param $entity_type
* The type of object; e.g. 'node' or 'user'.
* The type of entity; e.g. 'node' or 'user'.
*
* @return
* An array of bundles for the $entity_type keyed by bundle name,
* or, if no $entity_type was provided, the array of all existing bundles,
* keyed by object type.
* keyed by entity type.
*/
function field_info_bundles($entity_type = NULL) {
$info = entity_get_info();
......@@ -562,13 +562,13 @@ function field_info_field_by_id($field_id) {
* Retrieves information about field instances.
*
* @param $entity_type
* The object type for which to return instances.
* The entity type for which to return instances.
* @param $bundle_name
* The bundle name for which to return instances.
*
* @return
* If $entity_type is not set, return all instances keyed by object type and
* bundle name. If $entity_type is set, return all instances for that object
* If $entity_type is not set, return all instances keyed by entity type and
* bundle name. If $entity_type is set, return all instances for that entity
* type, keyed by bundle name. If $entity_type and $bundle_name are set, return
* all instances for that bundle.
*/
......@@ -590,7 +590,7 @@ function field_info_instances($entity_type = NULL, $bundle_name = NULL) {
* Returns an array of instance data for a specific field and bundle.
*
* @param $entity_type
* The object type for the instance.
* The entity type for the instance.
* @param $field_name
* The field name for the instance.
* @param $bundle_name
......
......@@ -2,7 +2,7 @@
// $Id$
/**
* @file
* Attach custom data fields to Drupal objects.
* Attach custom data fields to Drupal entities.
*/
/*
......@@ -20,11 +20,11 @@
/**
* @defgroup field Field API
* @{
* Attach custom data fields to Drupal objects.
* Attach custom data fields to Drupal entities.
*
* 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
* 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
......@@ -42,11 +42,11 @@
* Modules use this API, often in hook_install(), to create
* custom data structures.
*
* - @link field_attach Field Attach API @endlink. Connects object
* - @link field_attach Field Attach API @endlink. Connects entity
* 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
* other functions for field data connected to individual entities.
* Fieldable entity types like node and user use this API to make
* themselves fieldable.
*
* - @link field_info Field Info API @endlink. Exposes information
......@@ -83,13 +83,13 @@
define('FIELD_BEHAVIOR_CUSTOM', 0x0004);
/**
* Age argument for loading the most recent version of an object's
* Age argument for loading the most recent version of an entity's
* field data with field_attach_load().
*/
define('FIELD_LOAD_CURRENT', 'FIELD_LOAD_CURRENT');
/**
* Age argument for loading the version of an object's field data
* specified in the object with field_attach_load().
* Age argument for loading the version of an entity's field data
* specified in the entity with field_attach_load().
*/
define('FIELD_LOAD_REVISION', 'FIELD_LOAD_REVISION');
......@@ -101,7 +101,7 @@
/**
* Limit argument for field_attach_query() to request all available
* objects instead of a limited number.
* entities instead of a limited number.
*/
define('FIELD_QUERY_NO_LIMIT', 'FIELD_QUERY_NO_LIMIT');
......@@ -143,7 +143,7 @@ function field_help($path, $arg) {
case 'admin/help#field':
$output = '';
$output .= '<h3>' . t('About') . '</h3>';
$output .= '<p>' . t('The Field module allows custom data fields to be attached to Drupal <em>objects</em> (content nodes, users, taxonomy vocabularies, etc.) and takes care of storing, loading, editing, and rendering field data. Most users will not interact with the Field module directly, but will instead use the <a href="@field-ui-help">Field UI module</a> user interface. Module developers can use the Field API to make new objects "fieldable" and thus allow fields to be attached to their objects. For more information, see the online handbook entry for <a href="@field">Field module</a>.', array('@field-ui-help' => url('admin/help/field_ui'), '@field' => 'http://drupal.org/handbook/modules/field')) . '</p>';
$output .= '<p>' . t('The Field module allows custom data fields to be attached to Drupal <em>entities</em> (content nodes, users, taxonomy vocabularies, etc.) and takes care of storing, loading, editing, and rendering field data. Most users will not interact with the Field module directly, but will instead use the <a href="@field-ui-help">Field UI module</a> user interface. Module developers can use the Field API to make new entities "fieldable" and thus allow fields to be attached to their entities. For more information, see the online handbook entry for <a href="@field">Field module</a>.', array('@field-ui-help' => url('admin/help/field_ui'), '@field' => 'http://drupal.org/handbook/modules/field')) . '</p>';
$output .= '<h3>' . t('Uses') . '</h3>';
$output .= '<dl>';
$output .= '<dt>' . t('Enabling field types') . '</dt>';
......@@ -272,12 +272,12 @@ function field_associate_fields($module) {
}
/**
* Helper function to get the default value for a field on an object.
* Helper function to get the default value for a field on an entity.
*
* @param $entity_type
* The type of $entity; e.g. 'node' or 'user'.
* @param $entity
* The object for the operation.
* The entity for the operation.
* @param $field
* The field structure.
* @param $instance
......@@ -381,7 +381,7 @@ function field_extra_fields($entity_type, $bundle) {
$info = (array) module_invoke_all('field_extra_fields');
drupal_alter('field_extra_fields', $info);
// Add saved weights. The array is keyed by object type, bundle and
// Add saved weights. The array is keyed by entity type, bundle and
// element name.
$extra_weights = variable_get('field_extra_weights', array());
foreach ($extra_weights as $entity_type_name => $bundles) {
......@@ -419,7 +419,7 @@ function field_extra_field_weight($entity_type, $bundle, $pseudo_field) {
}
/**
* Pre-render callback to adjust weights of non-field elements on objects.
* Pre-render callback to adjust weights of non-field elements on entities.
*/
function _field_extra_weights_pre_render($elements) {
if (isset($elements['#extra_fields'])) {
......@@ -566,7 +566,7 @@ function field_format($entity_type, $entity, $field, $item, $formatter_type = NU
}
/**
* Returns a renderable array for the value of a single field in an object.
* Returns a renderable array for the value of a single field in an entity.
*
* The resulting output is a fully themed field with label and multiple values.
*
......@@ -574,7 +574,7 @@ function field_format($entity_type, $entity, $field, $item, $formatter_type = NU
* isolated field.
* - Do not use inside node (or other entities) templates, use
* render($content[FIELD_NAME]) instead.
* - Do not use to display all fields in an object, use
* - Do not use to display all fields in an entity, use
* field_attach_prepare_view() and field_attach_view() instead.
*
* The function takes care of invoking the prepare_view steps. It also respects
......@@ -583,7 +583,7 @@ function field_format($entity_type, $entity, $field, $item, $formatter_type = NU
* @param $entity_type
* The type of $entity; e.g. 'node' or 'user'.
* @param $entity
* The object containing the field to display. Must at least contain the id
* The entity containing the field to display. Must at least contain the id
* key and the field data to display.
* @param $field_name
* The name of the field to display.
......@@ -591,7 +591,7 @@ function field_format($entity_type, $entity, $field, $item, $formatter_type = NU
* Can be either:
* - The name of a view mode. The field will be displayed according to the
* display settings specified for this view mode in the $instance
* definition for the field in the object's bundle.
* definition for the field in the entity's bundle.
* If no display settings are found for the view mode, the settings for
* the 'full' view mode will be used.
* - An array of display settings, as found in the 'display' entry of
......@@ -672,7 +672,7 @@ function field_view_field($entity_type, $entity, $field_name, $display = array()
* @param $field
* A field structure.
* @return
* TRUE if the field has data for any object; FALSE otherwise.
* TRUE if the field has data for any entity; FALSE otherwise.
*/
function field_has_data($field) {
$results = field_attach_query($field['id'], array(), array('limit' => 1));
......@@ -691,7 +691,7 @@ function field_has_data($field) {
* @param $entity_type
* The type of $entity; e.g. 'node' or 'user'.
* @param $entity
* (optional) The object for the operation.
* (optional) The entity for the operation.
* @param $account
* (optional) The account to check, if not given use currently logged in user.
* @return
......@@ -721,7 +721,7 @@ function field_access($op, $field, $entity_type, $entity = NULL, $account = NULL
* @param $entity_type
* The type of $entity; e.g. 'node' or 'user'.
* @param $bundle
* The bundle object (or string if bundles for this object type do not exist
* The bundle object (or string if bundles for this entity type do not exist
* as standalone objects).
* @return
* The bundle name.
......
......@@ -95,13 +95,13 @@ function field_multilingual_content_languages() {
* TRUE, if the handler is allowed to manage field translations.
*/
function field_multilingual_check_translation_handlers($entity_type, $handler = NULL) {
$obj_info = entity_get_info($entity_type);
$entity_info = entity_get_info($entity_type);
if (isset($handler)) {
return isset($obj_info['translation'][$handler]) && !empty($obj_info['translation'][$handler]);
return isset($entity_info['translation'][$handler]) && !empty($entity_info['translation'][$handler]);
}
elseif (isset($obj_info['translation'])) {
foreach ($obj_info['translation'] as $handler_info) {
elseif (isset($entity_info['translation'])) {
foreach ($entity_info['translation'] as $handler_info) {
// The translation handler must use a non-empty data structure.
if (!empty($handler_info)) {
return TRUE;
......
......@@ -86,14 +86,13 @@ function _field_sql_storage_indexname($name, $index) {
}
/**
* Retrieve or assign an entity type id for an object type.
* Retrieve or assign an entity type id for an entity type.
*
* @param $entity_type
* The object type, such as 'node' or 'user'.
* The entity type, such as 'node' or 'user'.
* @return
* The entity type id.
*
* TODO: We need to decide on 'entity' or 'object'.
*/
function _field_sql_storage_etid($entity_type) {
$etid = variable_get('field_sql_storage_' . $entity_type . '_etid', NULL);
......@@ -434,7 +433,7 @@ function field_sql_storage_field_storage_write($entity_type, $entity, $op, $fiel
/**
* Implements hook_field_storage_delete().
*
* This function deletes data for all fields for an object from the database.
* This function deletes data for all fields for an entity from the database.
*/
function field_sql_storage_field_storage_delete($entity_type, $entity, $fields) {
list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
......@@ -452,7 +451,7 @@ function field_sql_storage_field_storage_delete($entity_type, $entity, $fields)
* Implements hook_field_storage_purge().
*
* This function deletes data from the database for a single field on
* an object.
* an entity.
*/
function field_sql_storage_field_storage_purge($entity_type, $entity, $field, $instance) {
list($id, $vid, $bundle) = entity_extract_ids($entity_type, $entity);
......@@ -548,7 +547,7 @@ function field_sql_storage_field_storage_query($field_id, $conditions, $options)
$query
->fields('t', array('bundle', 'entity_id', 'revision_id'))
->fields('e', array('type'))
// We need to ensure objects arrive in a consistent order for the
// We need to ensure entities arrive in a consistent order for the
// range() operation to work.
->orderBy('t.etid')
->orderBy('t.entity_id');
......@@ -556,11 +555,11 @@ function field_sql_storage_field_storage_query($field_id, $conditions, $options)
// Initialize results array
$return = array();
// Getting $count objects possibly requires reading more than $count rows
// Getting $count entities possibly requires reading more than $count rows
// since fields with multiple values span over several rows. We query for
// batches of $count rows until we've either read $count objects or received
// batches of $count rows until we've either read $count entities or received
// less rows than asked for.
$obj_count = 0;
$entity_count = 0;
do {
if ($options['limit'] != FIELD_QUERY_NO_LIMIT) {
$query->range($options['cursor'], $options['limit']);
......@@ -578,10 +577,10 @@ function field_sql_storage_field_storage_query($field_id, $conditions, $options)
if (!isset($return[$row->type][$id])) {
$return[$row->type][$id] = entity_create_stub_entity($row->type, array($row->entity_id, $row->revision_id, $row->bundle));
$obj_count++;
$entity_count++;
}
}
} while ($options['limit'] != FIELD_QUERY_NO_LIMIT && $row_count == $options['limit'] && $obj_count < $options['limit']);
} while ($options['limit'] != FIELD_QUERY_NO_LIMIT && $row_count == $options['limit'] && $entity_count < $options['limit']);
// The query is complete when the last batch returns less rows than asked
// for.
......
......@@ -114,7 +114,7 @@ class TextFieldTestCase extends DrupalWebTestCase {
$id = $match[1];
$this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), t('Entity was created'));
// Display the object.
// Display the entity.
$entity = field_test_entity_test_load($id);
$entity->content = field_attach_view($entity_type, $entity);
$this->content = drupal_render($entity->content);
......@@ -178,7 +178,7 @@ class TextFieldTestCase extends DrupalWebTestCase {
$id = $match[1];
$this->assertRaw(t('test_entity @id has been created.', array('@id' => $id)), t('Entity was created'));
// Display the object.
// Display the entity.
$entity = field_test_entity_test_load($id);
$entity->content = field_attach_view($entity_type, $entity);
$this->content = drupal_render($entity->content);
......@@ -211,7 +211,7 @@ class TextFieldTestCase extends DrupalWebTestCase {
$this->drupalPost(NULL, $edit, t('Save'));
$this->assertRaw(t('test_entity @id has been updated.', array('@id' => $id)), t('Entity was updated'));
// Display the object.
// Display the entity.
$entity = field_test_entity_test_load($id);
$entity->content = field_attach_view($entity_type, $entity);
$this->content = drupal_render($entity->content);
......
This diff is collapsed.
......@@ -64,7 +64,7 @@ function field_test_entity_info_alter(&$entity_info) {
}
/**
* Creates a new bundle for test_entity objects.
* Creates a new bundle for test_entity entities.
*
* @param $bundle
* The machine-readable name of the bundle.
......@@ -84,7 +84,7 @@ function field_test_create_bundle($bundle, $text = NULL) {
}
/**
* Renames a bundle for test_entity objects.
* Renames a bundle for test_entity entities.
*
* @param $bundle_old
* The machine-readable name of the bundle to rename.
......@@ -121,7 +121,7 @@ function field_test_delete_bundle($bundle) {
}
/**
* Creates a basic test_entity object.
* Creates a basic test_entity entity.
*/
function field_test_create_stub_entity($id = 1, $vid = 1, $bundle = 'test_bundle') {
$entity = new stdClass();
......
......@@ -254,19 +254,19 @@ function field_test_field_storage_query($field_id, $conditions, $count, &$cursor
$field_data = $data[$field['id']];
$sub_table = $load_current ? 'current' : 'revisions';
// We need to sort records by object type and object id.
// We need to sort records by entity type and entity id.
usort($field_data[$sub_table], '_field_test_field_storage_query_sort_helper');
// Initialize results array.
$return = array();
$obj_count = 0;
$entity_count = 0;
$rows_count = 0;
$rows_total = count($field_data[$sub_table]);
$skip = $cursor;
$skipped = 0;
foreach ($field_data[$sub_table] as $row) {
if ($count != FIELD_QUERY_NO_LIMIT && $obj_count >= $count) {
if ($count != FIELD_QUERY_NO_LIMIT && $entity_count >= $count) {
break;
}
......@@ -327,7 +327,7 @@ function field_test_field_storage_query($field_id, $conditions, $count, &$cursor
if (!isset($return[$row->type][$id])) {
$return[$row->type][$id] = entity_create_stub_entity($row->type, array($row->entity_id, $row->revision_id, $row->bundle));
$obj_count++;
$entity_count++;
}
}
else {
......@@ -349,7 +349,7 @@ function field_test_field_storage_query($field_id, $conditions, $count, &$cursor
/**
* Sort helper for field_test_field_storage_query().
*
* Sorts by object type and object id.
* Sorts by entity type and entity id.
*/
function _field_test_field_storage_query_sort_helper($a, $b) {
if ($a->type == $b->type) {
......
......@@ -26,7 +26,7 @@
* the label position is "above" it would result in "field-label-above".
*
* Other variables:
* - $element['#object']: The object to which the field is attached.
* - $element['#object']: The entity to which the field is attached.
* - $element['#view_mode']: View mode, e.g. 'full', 'teaser'...
* - $element['#field_name']: The field name.
* - $element['#field_type']: The field type.
......@@ -43,7 +43,7 @@
* @see theme_field()
*/
?>
<!--
<!--
THIS FILE IS NOT USED AND IS HERE AS A STARTING POINT FOR CUSTOMIZATION ONLY.
See http://api.drupal.org/api/function/theme_field/7 for details.
After copying this file to your theme's folder and customizing it, remove this
......
......@@ -790,7 +790,7 @@ function field_ui_existing_field_options($entity_type, $bundle) {
// Don't show
// - locked fields,
// - fields already in the current bundle,
// - field that cannot be added to the object type.
// - field that cannot be added to the entity type.
if (empty($field['locked'])
&& !field_info_instance($entity_type, $field['field_name'], $bundle)
&& (empty($field['object_types']) || in_array($entity_type, $field['object_types']))) {
......
......@@ -35,7 +35,7 @@ function field_ui_help($path, $arg) {
function field_ui_menu() {
$items['admin/reports/fields'] = array(
'title' => 'Field list',
'description' => 'Overview of fields on all object types.',
'description' => 'Overview of fields on all entity types.',
'page callback' => 'field_ui_fields_list',
'access arguments' => array('administer content types'),
'type' => MENU_NORMAL_ITEM,
......
......@@ -146,10 +146,10 @@ class FieldUITestCase extends DrupalWebTestCase {
$this->drupalGet(('admin/structure/types/manage/page/fields'));
$this->assertRaw(t('Add existing field'), t('"Add existing field" was found.'));
// Check that the list of options respects object type restrictions on
// fields. The 'comment' field is restricted to the 'comment' object type
// Check that the list of options respects entity type restrictions on
// fields. The 'comment' field is restricted to the 'comment' entity type
// and should not appear in the list.
$this->assertFalse($this->xpath('//select[@id="edit--add-existing-field-field-name"]//option[@value="comment"]'), t('The list of options respects object type restrictions.'));
$this->assertFalse($this->xpath('//select[@id="edit--add-existing-field-field-name"]//option[@value="comment"]'), t('The list of options respects entity type restrictions.'));
// Add a new field based on an existing field.
$edit = array(
......@@ -206,7 +206,7 @@ class FieldUITestCase extends DrupalWebTestCase {
* @param $string
* The settings text.
* @param $entity_type
* The object type for the instance.
* The entity type for the instance.
*/
function assertFieldSettings($bundle, $field_name, $string = 'dummy test string', $entity_type = 'node') {
// Reset the fields info.
......
......@@ -205,21 +205,21 @@ function _file_generic_settings_file_directory_validate($element, &$form_state)
* Implements hook_field_load().
*/
function file_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) {
foreach ($entities as $obj_id => $entity) {
foreach ($entities as $id => $entity) {
// Load the files from the files table.
$fids = array();
foreach ($items[$obj_id] as $delta => $item) {
foreach ($items[$id] as $delta => $item) {
$fids[] = $item['fid'];
}
$files = file_load_multiple($fids);
foreach ($items[$obj_id] as $delta => $item) {
foreach ($items[$id] as $delta => $item) {
// If the file does not exist, mark the entire item as empty.
if (empty($item['fid']) || !isset($files[$item['fid']])) {
$items[$obj_id][$delta] = NULL;
$items[$id][$delta] = NULL;
}
else {
$items[$obj_id][$delta] = array_merge($item, (array) $files[$item['fid']]);
$items[$id][$delta] = array_merge($item, (array) $files[$item['fid']]);
}
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment