public function BrightcovePlaylistEntityController::load in Brightcove Video Connect 7.6
Same name and namespace in other branches
- 7.7 brightcove.playlist.inc \BrightcovePlaylistEntityController::load()
Overwrites DrupalDefaultEntityController::load().
Parameters
array $ids: Array of ids. The format for an id is "1234-5" where 1234 is a Playlist->getId() and 5 is a Client->bcid.
$conditions:
Return value
\Brightcove\Object\Playlist[] An array of Playlist objects, keyed by the playlist id.
Overrides EntityAPIController::load
1 call to BrightcovePlaylistEntityController::load()
- BrightcovePlaylistEntityController::delete in ./
brightcove.playlist.inc - Overwrites DrupalDefaultEntityController::delete().
File
- ./
brightcove.playlist.inc, line 70 - Brightcove playlist related functions.
Class
- BrightcovePlaylistEntityController
- Entity controller class for Brightcove client.
Code
public function load($ids = [], $conditions = []) {
$playlists = [];
$entity_info = entity_get_info('brightcove_playlist');
foreach ($ids as $id) {
$playlist_ids = explode('-', $id);
if (count($playlist_ids) != 2) {
continue;
}
$playlist_id = $playlist_ids[0];
$bcid = $playlist_ids[1];
$playlist = brightcove_load_playlist($playlist_id, $bcid);
if ($playlist) {
$values = [
$entity_info['entity keys']['id'] => $id,
'playlist_id' => $playlist_id,
$entity_info['entity keys']['label'] => $playlist
->getName(),
$entity_info['entity keys']['bundle'] => $playlist
->getType() == 'EXPLICIT' ? BRIGHTCOVE_PLAYLIST_TYPE_MANUAL : BRIGHTCOVE_PLAYLIST_TYPE_SMART,
'playlist' => $playlist,
'client' => brightcove_client_load($bcid),
];
$playlist_entity = entity_create('brightcove_playlist', $values);
$playlists[$id] = $playlist_entity;
}
}
field_attach_load('brightcove_playlist', $playlists);
return $playlists;
}