function theme_video_metadata in Video 5
Same name and namespace in other branches
- 6 plugins/video_optmetadata/video_optmetadata.module \theme_video_metadata()
- 6.2 plugins/video_optmetadata/video_optmetadata.module \theme_video_metadata()
Display optional metadata (Video and Audio bitrate,..) on the view page.
Parameters
$node: object with node information
Return value
string of content to display $node->video_bitrate, $node->audio_bitrate, $node->audio_sampling_rate, $node->audio_channels,
1 theme call to theme_video_metadata()
- video_optmetadata_nodeapi in plugins/
video_optmetadata/ video_optmetadata.module - Implementation of hook_nodeapi()
File
- plugins/
video_optmetadata/ video_optmetadata.module, line 109 - Enable addition of optional metadata on video nodes created by video module.
Code
function theme_video_metadata($node) {
//Make sure atleast one fields had data.
if ($node->video_bitrate != 0 or $node->audio_bitrate != 0 or $node->audio_sampling_rate != 0 or $node->audio_channels != 0) {
$output = "\n\n<div class=\"video_metadata\">\n";
$output .= ' <div class="title"><h2>' . t('Video Metadata') . "</h2></div>\n";
if ($node->video_bitrate != 0) {
$fields[] = array(
'title' => t('Video Bitrate') . ':',
'body' => $node->video_bitrate . ' ' . t('kbits/sec'),
);
}
if ($node->audio_bitrate != 0) {
$fields[] = array(
'title' => t('Audio Bitrate') . ':',
'body' => $node->audio_bitrate . ' ' . t('kbits/sec'),
);
}
if ($node->audio_sampling_rate != 0) {
$fields[] = array(
'title' => t('Audio Sampling Rate') . ':',
'body' => $node->audio_sampling_rate . ' ' . t('Hz'),
);
}
if ($node->audio_channels != '') {
$fields[] = array(
'title' => t('Audio Channels') . ':',
'body' => $node->audio_channels,
);
}
$output .= theme('video_fields', $fields);
//Generate the fields HTML.
$output .= '</div>';
//Closing div video_metadata
}
else {
//If all the fields are blank then display nothing.
$output = '';
}
return $output;
}