forked from q0rban/brightcove_media
-
Notifications
You must be signed in to change notification settings - Fork 0
/
brightcove_media.install
28 lines (27 loc) · 1010 Bytes
/
brightcove_media.install
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
<?php
/**
* Update Brightcove related player settings.
*/
function brightcove_media_update_7001() {
$entity_info = entity_get_info('file');;
$players = brightcove_player_load_all();
// Add Default view mode.
$view_modes = array_merge($entity_info['view modes'], array('default' => array()));
// Check display settings for all of the view modes.
foreach ($view_modes as $machine_name => $mode) {
$displays = file_displays_load('video', $machine_name);
foreach ($displays as $formatter_name => $display) {
if (strpos($formatter_name, 'brightcove_media_video') || strpos($formatter_name, 'brightcove_media_playlist')) {
if (!empty($players)) {
foreach ($players as $player) {
if ($display->settings['player'] == $player->pid) {
$display->settings['player'] = $player->name;
file_display_save($display);
}
}
}
}
}
}
return 'File display settings for Brightcove has been updated.';
}