function brightcove_get_playlists in Brightcove Video Connect 7.6
Same name and namespace in other branches
- 7.7 brightcove.playlist.inc \brightcove_get_playlists()
- 7.3 brightcove.playlist.inc \brightcove_get_playlists()
- 7.4 brightcove.playlist.inc \brightcove_get_playlists()
- 7.5 brightcove.playlist.inc \brightcove_get_playlists()
Get the playlists from Brightcove.
This function is a cached wrapper around BCMAPI::find('allplaylists'). It only loads the first 100 playlists.
Parameters
Entity $client: The brightcove_client entity object.
string $sort: (optional) Field to sort results on (use -field for descending order).
int $page: (optional) The page to get.
bool $cache_reset: (optional) True to reset the cache.
Return value
bool|array Array of playlists or FALSE if none found. @see http://support.brightcove.com/en/docs/media-api-objects-reference#Playlist
3 calls to brightcove_get_playlists()
- BrightcovePlaylistEntityUIController::overviewTable in ./
brightcove.playlist.inc - Renders the playlist overview table.
- brightcove_media_playlist_list in brightcove_media/
brightcove_media.module - brightcove/media/playlist/list menu callback function.
- _brightcove_field_get_playlists in ./
brightcove_field.playlist.inc
File
- ./
brightcove.playlist.inc, line 332 - Brightcove playlist related functions.
Code
function brightcove_get_playlists(Entity $client, $sort = NULL, $page = 0, $cache_reset = FALSE) {
brightcove_load_lib();
$cid = 'brightcove:playlist:list:' . $client->bcid . ':' . $page;
$cache = brightcove_cache_get($cid);
if (!$cache_reset && !empty($cache)) {
return $cache;
}
/** @var \Brightcove\Object\Playlist[] $playlists */
$playlists = [];
brightcove_try(function () use (&$playlists, $client, $sort, $page) {
/** @var \Brightcove\API\CMS $cms */
list($cms, ) = brightcove_create_classes($client);
$max_items = variable_get('brightcove_pager_max_items', 20);
$offset = $max_items * $page;
$playlists = $cms
->listPlaylists($sort, $max_items, $offset);
});
if ($playlists) {
brightcove_cache_set($cid, $playlists);
}
return $playlists ?: FALSE;
}