function brightcove_mm_complete_video in Brightcove Video Connect 6
Same name and namespace in other branches
- 6.2 brightcove.media_mover.inc \brightcove_mm_complete_video()
Complete operation for Media Mover - will attach a video to CCK field.
1 call to brightcove_mm_complete_video()
- brightcove_media_mover in ./
brightcove.module - Implementation of hook_media_mover().
File
- ./
brightcove.media_mover.inc, line 116 - Functions to implement Media Mover behavior for Brightcove.
Code
function brightcove_mm_complete_video($file, $configuration) {
if (!$file['nid']) {
watchdog('brightcove_mediamover', 'Did not find a node for attaching video to (complete phase)');
return FALSE;
}
$node = node_load($file['nid']);
$field = $configuration['brightcove_mm_config_complete_field'];
if (!($video = $file['storage_file'])) {
$video = $file['process_file'];
}
if (!empty($video) && isset($node->{$field})) {
$id = brightcove_parse_id($video);
$node->{$field}[0] = array(
'video_id' => brightcove_parse_id($video),
);
node_save($node);
watchdog('brightcove_mediamover', 'Attached a video %video to node %node (%nid)', array(
'%video' => $video,
'%node' => $node->title,
'%nid' => $node->nid,
), WATCHDOG_NOTICE);
}
return TRUE;
}