You are here

function video_field_views_data in Video 7.2

Implements hook_field_views_data().

Views integration for video fields. Adds a video relationship to the default field data.

See also

field_views_field_default_views_data()

Related topics

File

views/video.views.inc, line 128
Provide views data and handlers for statistics.module

Code

function video_field_views_data($field) {
  $data = field_views_field_default_views_data($field);
  foreach ($data as $table_name => $table_data) {

    // Add the relationship only on the fid field.
    $data[$table_name][$field['field_name'] . '_fid']['relationship'] = array(
      'handler' => 'views_handler_relationship',
      'base' => 'file_managed',
      'base field' => 'fid',
      'label' => t('video from !field_name', array(
        '!field_name' => $field['field_name'],
      )),
    );
    $data[$table_name][$field['field_name'] . '_thumbnail']['relationship'] = array(
      'handler' => 'views_handler_relationship',
      'base' => 'file_managed',
      'base field' => 'fid',
      'label' => t('video thumbnail from !field_name', array(
        '!field_name' => $field['field_name'],
      )),
    );
  }
  return $data;
}