-
Notifications
You must be signed in to change notification settings - Fork 0
/
sandbox.module
54 lines (48 loc) · 1.22 KB
/
sandbox.module
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
<?php
/**
* @file
* Code for the sandbox module.
*/
/**
* Implements hook_menu().
*/
function sandbox_menu() {
$items = array();
$items['admin/config/system/sand'] = array(
'title' => 'Sand particles',
'description' => 'Configure sand particles',
'route_name' => 'sandbox.sand_list',
);
return $items;
}
/**
* Implements hook_menu_link_defaults().
*/
function sandbox_menu_link_defaults() {
$links['sandbox.sand.list'] = array(
'link_title' => 'Sand particles',
'description' => 'Configure sand particles.',
'route_name' => 'sandbox.sand_list',
'parent' => 'system.admin.config.system',
);
return $links;
}
/**
* Implements hook_permission().
*/
function sandbox_permission() {
$permissions = array();
// For each protection rule, create a permission to bypass the rule.
foreach (entity_load_multiple('sand') as $rule) {
$vars = array(
'%label' => $rule->label(),
);
$permissions += array(
'userprotect.' . $rule->id() . '.bypass' => array(
'title' => t('Bypass user protection for %label', $vars),
'description' => t('The user protection rule %label is ignored for users with this permission.', $vars),
),
);
}
return $permissions;
}