You are here

function field_attach_load_revision in Drupal 7

Load all fields for previous versions of a group of entities.

Loading different versions of the same entities is not supported, and should be done by separate calls to the function.

field_attach_load_revision() is automatically called by the default entity controller class, and thus, in most cases, doesn't need to be explicitly called by the entity type module.

Parameters

$entity_type: The type of $entity; e.g. 'node' or 'user'.

$entities: An array of entities for which to load fields, keyed by entity ID. Each entity needs to have its 'bundle', 'id' and (if applicable) 'revision' keys filled. The function adds the loaded field data directly in the entity objects of the $entities array.

$options: An associative array of additional options. See field_attach_load() for details.

Related topics

5 calls to field_attach_load_revision()
DrupalDefaultEntityController::attachLoad in includes/entity.inc
Attaches data to entities upon loading.
FieldAttachStorageTestCase::testFieldAttachDelete in modules/field/tests/field.test
Test field_attach_delete().
FieldAttachStorageTestCase::testFieldAttachSaveLoad in modules/field/tests/field.test
Check field values insert, update and load.
FieldSqlStorageTestCase::testFieldAttachLoad in modules/field/modules/field_sql_storage/field_sql_storage.test
Uses the mysql tables and records to verify field_load_revision works correctly.
field_test_entity_test_load in modules/field/tests/field_test.entity.inc
Loads a test_entity.

File

modules/field/field.attach.inc, line 757
Field attach API, allowing entities (nodes, users, ...) to be 'fieldable'.

Code

function field_attach_load_revision($entity_type, $entities, $options = array()) {
  return field_attach_load($entity_type, $entities, FIELD_LOAD_REVISION, $options);
}