You are here

function audiofield_field_prepare_view in AudioField 7

Implements hook_field_prepare_view().

File

./audio.field.inc, line 11
Implement an audio field, based on the file module's file field.

Code

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

  // TODO: Check this.
  // Remove files specified to not be displayed.
  foreach ($entities as $id => $entity) {
    foreach ($items[$id] as $delta => $item) {
      if (!file_field_displayed($item, $field)) {
        unset($items[$id][$delta]);
      }

      // Ensure consecutive deltas.
      $items[$id] = array_values($items[$id]);
    }
  }
}