-
Notifications
You must be signed in to change notification settings - Fork 3
/
media_avportal.install
48 lines (41 loc) · 1.12 KB
/
media_avportal.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
<?php
/**
* @file
* Contains installation hooks.
*/
declare(strict_types=1);
/**
* Implements hook_update_N().
*
* Updates fields using previous avportal formatter.
*/
function media_avportal_update_8001() {
$properties = [
'targetEntityType' => 'media',
];
$view_displays = \Drupal::entityTypeManager()->getStorage('entity_view_display')->loadByProperties($properties);
if (!$view_displays) {
return;
}
foreach ($view_displays as $view_display) {
foreach ($view_display->getComponents() as $field => $component) {
if ($component['type'] !== 'avportal') {
continue;
}
$component['type'] = 'avportal_video';
$view_display->setComponent($field, $component);
$view_display->save();
}
}
}
/**
* Implements hook_update_N().
*
* Updates avportal webservice endpoint.
*/
function media_avportal_update_8002() {
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('media_avportal.settings');
$config->set('client_api_uri', 'https://gfdwwnbuul.execute-api.eu-west-1.amazonaws.com/avsportal/avsportal');
$config->save(TRUE);
}