-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbf_base.install
109 lines (98 loc) · 2.52 KB
/
bf_base.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
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
<?php
/**
* Implements hook_install().
*
* Perform actions to set up the site for this profile.
* We'll just call the install method from the standard install here.
* Everything else we do will be on top of that.
*/
/* just for the reference
function candw_install() {
include_once DRUPAL_ROOT . '/profiles/standard/standard.install';
standard_install();
}
*/
/**
* This is taken from Panopoly until we make something better
*/
/**
* @file
* Install, update and uninstall hooks.
*/
/**
* Implements hook_install().
*/
function bf_base_install() {
_bf_base_install_help_block();
}
/**
* Enable the Distribution Update Status Manager (distro_update) module.
*/
function bf_base_update_7101() {
module_enable(array('distro_update'));
}
/**
* Enable the core Block module and place the Help block.
*/
function bf_base_update_7102() {
if (!module_exists('block')) {
module_enable(array('block'));
}
_bf_base_install_help_block();
}
/**
* Helper function: add Help block to default/admin theme Help region.
*/
function _bf_base_install_help_block() {
$default_theme = variable_get('theme_default', 'responsive_bartik');
$admin_theme = variable_get('admin_theme', $default_theme);
// Add the help block to the main theme help region.
$blocks = array(
array(
'module' => 'system',
'delta' => 'help',
'theme' => $default_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',
'pages' => '',
'cache' => -1,
),
);
// If the admin theme is different than default theme, add the help
// block to the admin them help region.
if ($admin_theme != $default_theme) {
$blocks[] = array(
'module' => 'system',
'delta' => 'help',
'theme' => $admin_theme,
'status' => 1,
'weight' => 0,
'region' => 'help',
'pages' => '',
'cache' => -1,
);
}
// Add the blocks if they aren't already placed.
foreach ($blocks as $block) {
$region = db_select('block', 'b')
->fields('b', array('region'))
->condition('theme', $block['theme'])
->condition('module', $block['module'])
->condition('delta', $block['delta'])
->execute()
->fetchField();
if (empty($region) || $region == -1) {
db_merge('block')
->key(array(
'theme' => $block['theme'],
'module' => $block['module'],
'delta' => $block['delta'],
))
->fields($block)
->execute();
}
}
// Update the menu router information.
menu_rebuild();
}