function file_field_views_data

Implements hook_field_views_data().

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

See also

field_views_field_default_views_data()

File

drupal/core/modules/file/file.views.inc, line 465
Provide views data and handlers for file.module.

Code

function file_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(
      'id' => 'standard',
      'base' => 'file_managed',
      'entity type' => 'file',
      'base field' => 'fid',
      'label' => t('file from !field_name', array(
        '!field_name' => $field['field_name'],
      )),
    );
  }
  return $data;
}