-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcaw_profile.post_update.php
More file actions
58 lines (55 loc) · 1.79 KB
/
caw_profile.post_update.php
File metadata and controls
58 lines (55 loc) · 1.79 KB
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
57
58
<?php
/**
* @file
* caw_profile.install
*/
/**
* Implements hook_removed_post_updates().
*/
function caw_profile_removed_post_updates() {
return [
'caw_profile_post_update_8001' => '8.x-1.13',
'caw_profile_post_update_8003' => '8.x-1.13',
'caw_profile_post_update_8013' => '8.x-1.13',
'caw_profile_post_update_8014' => '11.0.0',
'caw_profile_post_update_8015' => '11.0.0',
'caw_profile_post_update_8202' => '11.0.0',
'caw_profile_post_update_update_field_defs' => '11.0.0',
'caw_profile_post_update_layout_builder_block' => '11.0.0',
'caw_profile_post_update_site_orgs' => '11.0.0',
'caw_profile_post_update_event_pages' => '11.0.0',
'caw_profile_post_update_header_links_block' => '11.0.0',
'caw_profile_post_update_unpublished_site_banner' => '11.0.0',
];
}
/**
* Create new rabbit hole message block for subthemes.
*/
function caw_profile_post_update_rabbit_hole_block() {
$theme = \Drupal::config('system.theme')->get('default');
if (in_array($theme, ['stanford_basic', 'minimally_branded_subtheme', 'caw_theme'])) {
return;
}
\Drupal::entityTypeManager()->getStorage('block')->create([
'id' => "{$theme}_rabbit_hole_message",
'theme' => $theme,
'region' => 'content',
'weight' => -10,
'plugin' => 'rabbit_hole_message',
'settings' => [
'id' => 'rabbit_hole_message',
'label' => 'Rabbit Hole Message',
'label_display' => 0,
'provider' => 'stanford_profile_helper',
'context_mapping' => ['node' => '@node.node_route_context:node'],
],
'visibility' => [
'user_role' => [
'id' => 'user_role',
'negate' => TRUE,
'context_mapping' => ['user' => '@user.current_user_context:current_user'],
'roles' => ['anonymous' => 'anonymous'],
],
],
])->save();
}