You are here

function brightcove_playlist_load in Brightcove Video Connect 7.5

Same name and namespace in other branches
  1. 7.7 brightcove.playlist.inc \brightcove_playlist_load()
  2. 7.3 brightcove.module \brightcove_playlist_load()
  3. 7.4 brightcove.module \brightcove_playlist_load()
  4. 7.6 brightcove.playlist.inc \brightcove_playlist_load()

Parameters

$playlist_id:

bool $reset:

Return value

bool|object

4 calls to brightcove_playlist_load()
brightcove_field_browser_playlist_validate in brightcove_field/brightcove_field.module
Validate callback for the playlist field.
brightcove_field_field_formatter_view in brightcove_field/brightcove_field.module
Implements hook_field_formatter_view().
brightcove_field_field_validate in brightcove_field/brightcove_field.module
Implements hook_field_validate().
brightcove_field_playlist_browser_value in brightcove_field/brightcove_field.module
Callback for Brightcove field browser widget. Will return a field value in "playlist-name [id:playlistId]" format.

File

./brightcove.module, line 292
Brightcove module is an integration layer between any modules using Brightcove API. It makes all necessary checks for the API and makes settings available to the user.

Code

function brightcove_playlist_load($playlist_id, $reset = FALSE) {
  $cid = 'brightcove:playlist:' . $playlist_id;
  $cache = brightcove_cache_get($cid);
  if (!$reset && $cache) {
    return (object) $cache;
  }
  $playlist = FALSE;
  $bc = brightcove_initialize();
  try {
    $playlist = $bc
      ->find('playlistbyid', array(
      'playlist_id' => $playlist_id,
    ));
  } catch (Exception $e) {
    watchdog('brightcove', 'Loading brightcove playlists failed.', array(), WATCHDOG_ERROR);
  }
  if ($playlist) {
    brightcove_cache_set($cid, $playlist);
  }
  return $playlist;
}