You are here

function _brightcove_load_my_clients in Brightcove Video Connect 7.7

Same name and namespace in other branches
  1. 7.6 brightcove.module \_brightcove_load_my_clients()

Loads all clients which belong to a given or current user.

Parameters

null|stdClass $account:

Return value

array

2 calls to _brightcove_load_my_clients()
_brightcove_my_client_select_options in ./brightcove.module
_brightcove_upload_form_validate in ./brightcove.module
Validate callback for _brightcove_upload_form().

File

./brightcove.module, line 2865
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_load_my_clients($account = NULL) {

  // Load all brightcove_client entities.
  // We need $reset = TRUE otherwise we get no clients in an AJAX call.
  $clients = entity_load('brightcove_client', FALSE, [], TRUE);

  // Keep only the clients $account has access to.
  $clients = array_filter($clients, function ($client) use ($account) {
    return brightcove_client_access('use', $client, $account);
  });
  return $clients;
}