function video_views_tables in Video 5
Same name and namespace in other branches
- 6 views_video.inc \video_views_tables()
Implementation of hook_views_tables
Return value
array - Enables support in the video module for views integration
File
- ./
views_video.inc, line 10
Code
function video_views_tables() {
$tables['video'] = array(
'name' => 'video',
'join' => array(
'left' => array(
'table' => 'node',
'field' => 'vid',
),
'right' => array(
'field' => 'vid',
),
),
// Fields that can be inserted into a view
'fields' => array(
'play_counter' => array(
'name' => t('Video: Play count'),
'sortable' => true,
'help' => t('This will display the number of times this has been played.'),
),
'download_counter' => array(
'name' => t('Video: Download count'),
'sortable' => true,
'help' => t('This will display the number of times this has been downloaded.'),
),
'playtime_seconds' => array(
'name' => t('Video: Length'),
'handler' => 'video_views_handler_field_playtime_seconds',
'sortable' => true,
'help' => t('This will display the play length of the video.'),
),
'download_link' => array(
'name' => t('Video: Download link'),
'handler' => 'video_views_handler_field_download',
'notafield' => true,
'sortable' => false,
'help' => t('This will display a download link if the node allows it.'),
),
'play_link' => array(
'name' => t('Video: Play link'),
'handler' => 'video_views_handler_field_play',
'notafield' => true,
'sortable' => false,
'help' => t('This will display a play link if the node allows it.'),
),
'videox' => array(
'name' => t('Video: Width (x)'),
'sortable' => true,
'help' => t('This will display the width (x) of the video'),
),
'videoy' => array(
'name' => t('Video: Height (y)'),
'sortable' => true,
'help' => t('This will display the height (y) of the video'),
),
),
'sorts' => array(
'play_counter' => array(
'name' => t('Video: Play count'),
'help' => t('Sort by the number of video plays.'),
),
'download_counter' => array(
'name' => t('Video: Download count'),
'help' => t('Sort by the number of video downloads.'),
),
'playtime_seconds' => array(
'name' => t('Video: Length'),
'help' => t('Sort by the video length.'),
),
),
);
// Add video_image support only if the video_image module is enabled
if (module_exists('video_image')) {
$tables['video']['fields']['video_image'] = array(
'name' => t('Video: Thumbnail'),
'notafield' => true,
'handler' => 'video_views_handler_field_video_image',
'sortable' => false,
'help' => t('This will display the thumbnail image for the video.'),
);
}
return $tables;
}