You are here

function brightcove_cck_browser_value in Brightcove Video Connect 6.2

Same name and namespace in other branches
  1. 6 brightcove_cck/brightcove_cck.module \brightcove_cck_browser_value()

Callback for Brightcove CCK browser widget. Will return a field value in "video-name [id:videoId]" format.

1 string reference to 'brightcove_cck_browser_value'
brightcove_cck_widget in brightcove_cck/brightcove_cck.module
Implementation of hook_widget().

File

brightcove_cck/brightcove_cck.module, line 577
Brightcove CCK module provides a Content Construction Kit module to developers, allowing them to browse videos in their Brightcove Studio and upload them.

Code

function brightcove_cck_browser_value($element, $edit = FALSE) {
  $field_key = $element['#columns'][0];
  $id = $element['#default_value'][$field_key];
  if ((int) $id > 1) {
    $video = brightcove_video_load($id);
    if (!empty($video->id)) {
      return array(
        $field_key => check_plain($video->name) . ' [id:' . $video->id . ']',
      );
    }
    else {
      if (!is_null(brightcove_video_cache_get($id))) {
        return array(
          $field_key => check_plain(brightcove_video_cache_get($id)->name) . ' [id:' . $id . ']',
        );
      }
    }
  }
  return array(
    $field_key => NULL,
  );
}