You are here

function sarnia_field_load in Sarnia 7

Implements hook_field_load().

In general, this hook should have nothing to do, since the SarniaController tries to pre-load the field data.

See also

SarniaController::load()

File

./sarnia.module, line 680

Code

function sarnia_field_load($entity_type, $entities, $field, $instances, $langcode, &$items) {

  // If we didn't pre-load the field data in SarniaController::load(), copy it here.
  foreach ($entities as $id => $entity) {
    if (empty($entity->{$field['field_name']}) && isset($entity->_data)) {
      $entity->{$field['field_name']} = (array) $entity->_data;
      unset($entity->_data);
    }
  }
}