-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathworkbench_access.install
56 lines (49 loc) · 1.66 KB
/
workbench_access.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
50
51
52
53
54
55
56
<?php
/**
* @file
* Install, update and uninstall functions for the Workbench Access module.
*/
/**
* Add the setting to deny access to unassigned content.
*/
function workbench_access_update_8001() {
$config_factory = \Drupal::configFactory();
$config = $config_factory->getEditable('workbench_access.settings');
$config->set('deny_on_empty', 0);
$config->save(TRUE);
}
/**
* Update to new access scheme config entity.
*/
function workbench_access_update_8002() {
// Stash this for later.
\Drupal::state()->set('workbench_access_original_configuration', \Drupal::config('workbench_access.settings'));
// Alter it to the new format.
$config = \Drupal::configFactory()->getEditable('workbench_access.settings');
foreach (['scheme', 'label', 'plural_label', 'fields', 'parents'] as $delete) {
$config->clear($delete);
}
$config->save(TRUE);
}
/**
* Create the new access scheme entity type.
*/
function workbench_access_update_8003() {
$entity_manager = \Drupal::entityTypeManager();
$update_manager = \Drupal::entityDefinitionUpdateManager();
// Install 'access_scheme' config entity.
$entity_manager->clearCachedDefinitions();
$type = $entity_manager->getDefinition('access_scheme');
$update_manager->installEntityType($type);
}
/**
* Create the new section association entity type.
*/
function workbench_access_update_8004() {
$entity_manager = \Drupal::entityTypeManager();
$update_manager = \Drupal::entityDefinitionUpdateManager();
// Install 'section_association' content entity.
$entity_manager->clearCachedDefinitions();
$type = $entity_manager->getDefinition('section_association');
$update_manager->installEntityType($type);
}