You are here

function panopoly_widgets_field_load in Panopoly Widgets 7

Implements hook_field_load().

File

./panopoly_widgets.spotlight.inc, line 389
A specification for the custom spotlight entity that is part of Panopoly Widgets

Code

function panopoly_widgets_field_load($entity_type, $entities, $field, $instances, $langcode, &$items, $age) {
  $entity_items_copy = $items;
  image_field_load($entity_type, $entities, $field, $instances, $langcode, $items, $age);

  // Both image_field_load() and file_entity_entity_load() will overwrite the
  // 'title' and 'alt' with the one from the file. Here we save the originals
  // for later.
  foreach ($entity_items_copy as $entity_id => $items_copy) {
    foreach ($items_copy as $delta => $item) {
      $items[$entity_id][$delta]['field_title'] = $item['title'];
      $items[$entity_id][$delta]['field_alt'] = $item['alt'];
    }
  }
}