rules_admin.module
4.46 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
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
<?php
/**
* @file Rules Admin UI
*/
/**
* Implements hook_menu().
*/
function rules_admin_menu() {
// Reaction rules UI menu entries.
$reaction_path = 'admin/config/workflow/rules/reaction';
$items = rules_ui()->config_menu($reaction_path);
$items[$reaction_path] = array(
'title' => 'Rules',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -1,
);
$items[$reaction_path . '/add'] = array(
'title' => 'Add new rule',
'page callback' => 'drupal_get_form',
'page arguments' => array('rules_admin_add_reaction_rule', $reaction_path),
'access arguments' => array('administer rules'),
'type' => MENU_LOCAL_ACTION,
'file' => 'rules_admin.inc',
'weight' => 0,
);
$items[$reaction_path . '/import'] = array(
'title' => 'Import rule',
'page callback' => 'drupal_get_form',
'page arguments' => array('rules_ui_import_form', $reaction_path),
'access arguments' => array('administer rules'),
'file' => 'ui/ui.forms.inc',
'file path' => drupal_get_path('module', 'rules'),
'type' => MENU_LOCAL_ACTION,
);
// Components UI menu entries.
$component_path = 'admin/config/workflow/rules/components';
$items += rules_ui()->config_menu($component_path);
$items[$component_path] = array(
'title' => 'Components',
'page callback' => 'drupal_get_form',
'page arguments' => array('rules_admin_components_overview', $component_path),
'access arguments' => array('administer rules'),
'type' => MENU_LOCAL_TASK,
'file' => 'rules_admin.inc',
'weight' => 0,
);
$items[$component_path . '/add'] = array(
'title' => 'Add new component',
'page callback' => 'drupal_get_form',
'page arguments' => array('rules_admin_add_component', $component_path),
'access arguments' => array('administer rules'),
'type' => MENU_LOCAL_ACTION,
'file' => 'rules_admin.inc',
'weight' => 0,
);
$items[$component_path . '/import'] = array(
'title' => 'Import component',
'page callback' => 'drupal_get_form',
'page arguments' => array('rules_ui_import_form', $component_path),
'access arguments' => array('administer rules'),
'file' => 'ui/ui.forms.inc',
'file path' => drupal_get_path('module', 'rules'),
'type' => MENU_LOCAL_ACTION,
);
// Some general rules admin menu items.
$items['admin/config/workflow/rules'] = array(
'title' => 'Rules',
'position' => 'right',
'page callback' => 'drupal_get_form',
'page arguments' => array('rules_admin_reaction_overview', $reaction_path),
'description' => 'Manage reaction rules and rule components.',
'access arguments' => array('administer rules'),
'file' => 'rules_admin.inc',
);
$items['admin/config/workflow/rules/settings'] = array(
'title' => 'Settings',
'page callback' => 'drupal_get_form',
'page arguments' => array('rules_admin_settings'),
'access arguments' => array('administer rules'),
'type' => MENU_LOCAL_TASK,
'file' => 'rules_admin.inc',
'weight' => 1,
);
$items['admin/config/workflow/rules/settings/basic'] = array(
'title' => 'Basic',
'type' => MENU_DEFAULT_LOCAL_TASK,
'weight' => -10,
);
$items['admin/config/workflow/rules/settings/advanced'] = array(
'title' => 'Advanced',
'type' => MENU_LOCAL_TASK,
'page callback' => 'drupal_get_form',
'page arguments' => array('rules_admin_settings_advanced'),
'access arguments' => array('administer rules'),
'file' => 'rules_admin.inc',
);
return $items;
}
/**
* Implements hook_form_alter().
*
* Since the overview forms are GET forms, we don't want them to send a wide
* variety of information. We need to use hook_form_alter() because the
* properties are added after form creation.
*/
function rules_admin_form_alter(&$form, &$form_state, $form_id) {
if ($form_id == 'rules_admin_reaction_overview' || $form_id == 'rules_admin_components_overview') {
$form['form_build_id']['#access'] = FALSE;
$form['form_token']['#access'] = FALSE;
$form['form_id']['#access'] = FALSE;
}
}
/**
* Implements hook_system_info_alter().
*
* Adds configuration links for Rules and Rules Scheduler in the modules list.
* (This is done by the Rules UI module, without which there would be no
* configuration pages to visit.)
*/
function rules_admin_system_info_alter(&$info, $file, $type) {
if ($file->name == 'rules') {
$info['configure'] = 'admin/config/workflow/rules';
}
if ($file->name == 'rules_scheduler') {
$info['configure'] = 'admin/config/workflow/rules/schedule';
}
}