You are here

function brightcove_field_storage_load in Brightcove Video Connect 7.7

Same name and namespace in other branches
  1. 7.6 brightcove.module \brightcove_field_storage_load()

Implements hook_field_storage_load().

File

./brightcove.module, line 2101
Brightcove module is an integration layer between any modules using Brightcove API. It makes all necessary checks for the API and makes settings available to the user.

Code

function brightcove_field_storage_load($entity_type, $entities, $age, $fields, $options) {
  if ($entity_type == 'brightcove_playlist') {
    foreach ($fields as $field_id => $ids) {
      $field = field_info_field_by_id($field_id);
      $field_name = $field['field_name'];
      foreach ($ids as $id) {
        $video_ids = $entities[$id]->playlist
          ->getVideoIds();
        foreach ($video_ids as $video_id) {
          $entities[$id]->{$field_name}[LANGUAGE_NONE][] = [
            'brightcove_id' => $video_id,
            'bcid' => $entities[$id]->client->bcid,
          ];
        }
      }
    }
  }
}