You are here

function hook_field_collection_item_load in Field collection 7

Acts on field collections being loaded from the database.

This hook is invoked during field collection item loading, which is handled by entity_load(), via the EntityCRUDController.

Parameters

array $entities: An array of field collection item entities being loaded, keyed by id.

See also

hook_entity_load()

File

./field_collection.api.php, line 41
Contains API documentation and examples for the Field Collection.

Code

function hook_field_collection_item_load(array $entities) {
  $result = db_query('SELECT pid, foo FROM {mytable} WHERE pid IN(:ids)', array(
    ':ids' => array_keys($entities),
  ));
  foreach ($result as $record) {
    $entities[$record->pid]->foo = $record->foo;
  }
}