forked from patdunlavey/islandora_mirador
-
Notifications
You must be signed in to change notification settings - Fork 0
/
islandora_mirador.install
49 lines (43 loc) · 1.04 KB
/
islandora_mirador.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
49
<?php
/**
* @file
* Install/update hook implementations.
*/
use Drupal\taxonomy\Entity\Term;
/**
* Implements hook_install().
*/
function islandora_mirador_install() {
_get_or_create_tag();
}
/**
* Implements hook_update().
*/
function islandora_mirador_update_8001() {
_get_or_create_tag();
}
/**
* Set a default config value for mirador_library_installation_type
* @return void
*/
function islandora_mirador_update_20001() {
$config = \Drupal::configFactory()->getEditable('islandora_mirador.settings');
$config->set('mirador_library_installation_type', 'remote');
$config->save();
}
/**
* Looks up or creates Mirador term.
*/
function _get_or_create_tag() {
$term_name = 'Mirador';
$test_terms = taxonomy_term_load_multiple_by_name($term_name);
if (!$test_terms) {
$term = Term::create([
'parent' => [],
'name' => $term_name,
'vid' => 'islandora_display',
'description' => 'Display using the Mirador viewer',
'field_external_uri' => ['uri' => 'https://projectmirador.org'],
])->save();
}
}