You are here

function _brightcove_playlist_items_total in Brightcove Video Connect 7.6

Same name and namespace in other branches
  1. 7.7 brightcove.module \_brightcove_playlist_items_total()
2 calls to _brightcove_playlist_items_total()
BrightcovePlaylistEntityUIController::overviewTable in ./brightcove.playlist.inc
Renders the playlist overview table.
_brightcove_field_playlist_widget_form in ./brightcove_field.playlist.inc
Helper function to return the playlist widget form.

File

./brightcove.module, line 3442
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_items_total(Entity $client, $cache_reset = FALSE) {
  $cid = "brightcove:playlist:count:{$client->bcid}";
  $cache = brightcove_cache_get($cid);
  if (!$cache_reset && !empty($cache)) {
    return $cache;
  }
  $playlist_count = 0;

  /** @var \Brightcove\API\CMS $cms */
  list($cms, ) = brightcove_create_classes($client);
  brightcove_try(function () use (&$playlist_count, $cms) {
    $playlist_count = $cms
      ->countPlaylists();
  });
  if (!empty($playlist_count)) {
    brightcove_cache_set($cid, $playlist_count);
  }
  return $playlist_count;
}