You are here

function _video_field_get_all_converted in Video 7.2

4 calls to _video_field_get_all_converted()
video_field_delete in ./video.field.inc
Implements hook_field_delete().
video_field_delete_revision in ./video.field.inc
Implements hook_field_delete_revision().
video_field_insert in ./video.field.inc
Implements hook_field_insert().
video_field_update in ./video.field.inc
Implements hook_field_update().

File

./video.field.inc, line 1439
Implement a video field, based on the file module's file field.

Code

function _video_field_get_all_converted(array $items, $usage_entity_type = NULL, $usage_entity_id = NULL) {
  if (empty($items)) {
    return array();
  }
  $videofids = array();
  foreach ($items as $item) {
    if (!empty($item['fid'])) {
      $videofids[] = intval($item['fid']);
    }
  }
  if (empty($videofids)) {
    return array();
  }
  $query = db_select('video_output', 't')
    ->fields('t', array(
    'output_fid',
  ))
    ->condition('original_fid', $videofids, 'IN');

  // Only return files with usage when requested
  if ($usage_entity_type != NULL && $usage_entity_id != NULL) {
    $query
      ->innerJoin('file_usage', 'u', 'u.fid = t.output_fid AND u.type = :type AND u.id = :id', array(
      ':type' => $usage_entity_type,
      ':id' => $usage_entity_id,
    ));
  }
  $convertedfids = $query
    ->execute()
    ->fetchCol(0);
  return video_utility::objectToArray(file_load_multiple($convertedfids));
}