diff --git a/core/modules/file/src/FileViewsData.php b/core/modules/file/src/FileViewsData.php index 17a0138..0ce7468 100644 --- a/core/modules/file/src/FileViewsData.php +++ b/core/modules/file/src/FileViewsData.php @@ -252,6 +252,39 @@ public function getViewsData() { ), ); + // Describes relationships between files and taxonomy_vocabulary items. + $data['file_usage']['file_to_taxonomy_vocabulary'] = array( + 'title' => t('Taxonomy Vocabulary'), + 'help' => t('A taxonomy vocabulary that is associated with this file, usually because this file is in a field on the taxonomy vocabulary.'), + // Only provide this field/relationship/etc., + // when the 'file_managed' base table is present. + 'skip base' => array('node_field_data', 'node_field_revision', 'users_field_data', 'comment_field_data', 'taxonomy_term_field_data', 'taxonomy_vocabulary'), + 'real field' => 'id', + 'relationship' => array( + 'title' => t('Taxonomy Vocabulary'), + 'label' => t('Taxonomy Vocabulary'), + 'base' => 'taxonomy_vocabulary', + 'base field' => 'vid', + 'relationship field' => 'id', + 'extra' => array(array('table' => 'file_usage', 'field' => 'type', 'operator' => '=', 'value' => 'taxonomy_vocabulary')), + ), + ); + $data['file_usage']['taxonomy_vocabulary_to_file'] = array( + 'title' => t('File'), + 'help' => t('A file that is associated with this taxonomy vocabulary, usually because it is in a field on the taxonomy vocabulary.'), + // Only provide this field/relationship/etc., + // when the 'taxonomy_vocabulary' base table is present. + 'skip base' => array('file_managed', 'node_field_data', 'node_field_revision', 'users_field_data', 'comment_field_data', 'taxonomy_term_field_data'), + 'real field' => 'fid', + 'relationship' => array( + 'title' => t('File'), + 'label' => t('File'), + 'base' => 'file_managed', + 'base field' => 'fid', + 'relationship field' => 'fid', + ), + ); + // Provide basic fields from the {file_usage} table to all of the base tables // we've declared joins to, because there is no 'skip base' property on these // fields.