media.views.inc 664 B

12345678910111213141516171819202122232425
  1. <?php
  2. /**
  3. * @file
  4. * Provide Views data and handlers for media.module
  5. */
  6. /**
  7. * Implements hook_field_views_data().
  8. */
  9. function media_field_views_data($field) {
  10. $data = field_views_field_default_views_data($field);
  11. foreach ($data as $table_name => $table_data) {
  12. // Add the relationship only on the fid field.
  13. $data[$table_name][$field['field_name'] . '_fid']['relationship'] = array(
  14. 'handler' => 'views_handler_relationship',
  15. 'base' => 'file_managed',
  16. 'entity type' => 'file',
  17. 'base field' => 'fid',
  18. 'label' => t('file from !field_name', array('!field_name' => $field['field_name'])),
  19. );
  20. }
  21. return $data;
  22. }