forked from os2loop/profile
-
Notifications
You must be signed in to change notification settings - Fork 0
/
loop.install
109 lines (89 loc) · 2.24 KB
/
loop.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
/**
* @file
* Install, update and uninstall functions for the Loop installation profile.
*/
/**
* Implements hook_install().
*
* Setting up default and admin theme. Activate node editing from admin theme.
* Enable user tracking via Google Analytics.
* Setup "Page not found" and "Access denied" pages.
*
* @see system_install()
*/
function loop_install() {
// Set default variables.
$default_theme = 'loop';
$admin_theme = 'seven';
// Enable themes.
theme_enable(array($default_theme, $admin_theme));
// Enable $default_theme.
variable_set('theme_default', $default_theme);
// Enable $admin_theme.
variable_set('admin_theme', $admin_theme);
// Activate admin theme when editing a node.
variable_set('node_admin_theme', '1');
// Enable User tracking in Google Analytics.
variable_set('googleanalytics_trackuserid', 1);
// Setup page not found.
loop_page_not_found();
// Setup access denied page.
loop_access_denied_page();
// Ignore any other install messages.
drupal_get_messages();
// Clear caches.
drupal_flush_all_caches();
}
/**
* Add a basic page for page-not-found.
*/
function loop_page_not_found() {
$node = new stdClass();
$node->uid = 1;
$node->title = 'Page not found';
$node->type = 'page';
$node->language = 'und';
$node->field_ding_page_body = array(
'und' => array(
array(
'value' => 'Page not found',
'format' => 'editor',
'safe_value' => '<p>Page not found</p>',
),
),
);
$node->path = array(
'alias' => 'page-not-found',
'language' => 'und',
);
node_save($node);
// Set the 404 page.
variable_set('site_404', 'page-not-found');
}
/**
* Add a basic access denied page.
*/
function loop_access_denied_page() {
$node = new stdClass();
$node->uid = 1;
$node->title = 'Access denied';
$node->type = 'page';
$node->language = 'und';
$node->field_ding_page_body = array(
'und' => array(
array(
'value' => 'Access denied',
'format' => 'editor',
'safe_value' => '<p>Access denied</p>',
),
),
);
$node->path = array(
'alias' => 'access_denied',
'language' => 'und',
);
node_save($node);
// Set the 404 page.
variable_set('site_403', 'access_denied');
}