public function MediaViewsData::getViewsData in Drupal 9
Same name and namespace in other branches
- 8 core/modules/media/src/MediaViewsData.php \Drupal\media\MediaViewsData::getViewsData()
- 10 core/modules/media/src/MediaViewsData.php \Drupal\media\MediaViewsData::getViewsData()
Returns views data for the entity type.
Return value
array Views data in the format of hook_views_data().
Overrides EntityViewsData::getViewsData
File
- core/
modules/ media/ src/ MediaViewsData.php, line 15
Class
- MediaViewsData
- Provides the Views data for the media entity type.
Namespace
Drupal\mediaCode
public function getViewsData() {
$data = parent::getViewsData();
$data['media_field_data']['table']['wizard_id'] = 'media';
$data['media_field_revision']['table']['wizard_id'] = 'media_revision';
$data['media_revision']['revision_user']['help'] = $this
->t('The user who created the revision.');
$data['media_revision']['revision_user']['relationship']['label'] = $this
->t('revision user');
$data['media_revision']['revision_user']['filter']['id'] = 'user_name';
$data['media_revision']['table']['join']['media_field_data']['left_field'] = 'vid';
$data['media_revision']['table']['join']['media_field_data']['field'] = 'vid';
$data['media_field_data']['status_extra'] = [
'title' => $this
->t('Published status or admin user'),
'help' => $this
->t('Filters out unpublished media if the current user cannot view it.'),
'filter' => [
'field' => 'status',
'id' => 'media_status',
'label' => $this
->t('Published status or admin user'),
],
];
return $data;
}