1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file Rules Admin UI
|
5
|
*/
|
6
|
|
7
|
/**
|
8
|
* Implements hook_menu().
|
9
|
*/
|
10
|
function rules_admin_menu() {
|
11
|
// Reaction rules UI menu entries.
|
12
|
$reaction_path = 'admin/config/workflow/rules/reaction';
|
13
|
$items = rules_ui()->config_menu($reaction_path);
|
14
|
|
15
|
$items[$reaction_path] = array(
|
16
|
'title' => 'Rules',
|
17
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
18
|
'weight' => -1,
|
19
|
);
|
20
|
$items[$reaction_path . '/add'] = array(
|
21
|
'title' => 'Add new rule',
|
22
|
'page callback' => 'drupal_get_form',
|
23
|
'page arguments' => array('rules_admin_add_reaction_rule', $reaction_path),
|
24
|
'access arguments' => array('administer rules'),
|
25
|
'type' => MENU_LOCAL_ACTION,
|
26
|
'file' => 'rules_admin.inc',
|
27
|
'weight' => 0,
|
28
|
);
|
29
|
$items[$reaction_path . '/import'] = array(
|
30
|
'title' => 'Import rule',
|
31
|
'page callback' => 'drupal_get_form',
|
32
|
'page arguments' => array('rules_ui_import_form', $reaction_path),
|
33
|
'access arguments' => array('administer rules'),
|
34
|
'file' => 'ui/ui.forms.inc',
|
35
|
'file path' => drupal_get_path('module', 'rules'),
|
36
|
'type' => MENU_LOCAL_ACTION,
|
37
|
);
|
38
|
|
39
|
// Components UI menu entries.
|
40
|
$component_path = 'admin/config/workflow/rules/components';
|
41
|
$items += rules_ui()->config_menu($component_path);
|
42
|
$items[$component_path] = array(
|
43
|
'title' => 'Components',
|
44
|
'page callback' => 'drupal_get_form',
|
45
|
'page arguments' => array('rules_admin_components_overview', $component_path),
|
46
|
'access arguments' => array('administer rules'),
|
47
|
'type' => MENU_LOCAL_TASK,
|
48
|
'file' => 'rules_admin.inc',
|
49
|
'weight' => 0,
|
50
|
);
|
51
|
$items[$component_path . '/add'] = array(
|
52
|
'title' => 'Add new component',
|
53
|
'page callback' => 'drupal_get_form',
|
54
|
'page arguments' => array('rules_admin_add_component', $component_path),
|
55
|
'access arguments' => array('administer rules'),
|
56
|
'type' => MENU_LOCAL_ACTION,
|
57
|
'file' => 'rules_admin.inc',
|
58
|
'weight' => 0,
|
59
|
);
|
60
|
$items[$component_path . '/import'] = array(
|
61
|
'title' => 'Import component',
|
62
|
'page callback' => 'drupal_get_form',
|
63
|
'page arguments' => array('rules_ui_import_form', $component_path),
|
64
|
'access arguments' => array('administer rules'),
|
65
|
'file' => 'ui/ui.forms.inc',
|
66
|
'file path' => drupal_get_path('module', 'rules'),
|
67
|
'type' => MENU_LOCAL_ACTION,
|
68
|
);
|
69
|
|
70
|
// Some general rules admin menu items.
|
71
|
$items['admin/config/workflow/rules'] = array(
|
72
|
'title' => 'Rules',
|
73
|
'position' => 'right',
|
74
|
'page callback' => 'drupal_get_form',
|
75
|
'page arguments' => array('rules_admin_reaction_overview', $reaction_path),
|
76
|
'description' => 'Manage reaction rules and rule components.',
|
77
|
'access arguments' => array('administer rules'),
|
78
|
'file' => 'rules_admin.inc',
|
79
|
);
|
80
|
$items['admin/config/workflow/rules/settings'] = array(
|
81
|
'title' => 'Settings',
|
82
|
'page callback' => 'drupal_get_form',
|
83
|
'page arguments' => array('rules_admin_settings'),
|
84
|
'access arguments' => array('administer rules'),
|
85
|
'type' => MENU_LOCAL_TASK,
|
86
|
'file' => 'rules_admin.inc',
|
87
|
'weight' => 1,
|
88
|
);
|
89
|
$items['admin/config/workflow/rules/settings/basic'] = array(
|
90
|
'title' => 'Basic',
|
91
|
'type' => MENU_DEFAULT_LOCAL_TASK,
|
92
|
'weight' => -10,
|
93
|
);
|
94
|
$items['admin/config/workflow/rules/settings/advanced'] = array(
|
95
|
'title' => 'Advanced',
|
96
|
'type' => MENU_LOCAL_TASK,
|
97
|
'page callback' => 'drupal_get_form',
|
98
|
'page arguments' => array('rules_admin_settings_advanced'),
|
99
|
'access arguments' => array('administer rules'),
|
100
|
'file' => 'rules_admin.inc',
|
101
|
);
|
102
|
return $items;
|
103
|
}
|
104
|
|
105
|
/**
|
106
|
* Implements hook_form_alter().
|
107
|
*
|
108
|
* Since the overview forms are GET forms, we don't want them to send a wide
|
109
|
* variety of information. We need to use hook_form_alter() because the
|
110
|
* properties are added after form creation.
|
111
|
*/
|
112
|
function rules_admin_form_alter(&$form, &$form_state, $form_id) {
|
113
|
if ($form_id == 'rules_admin_reaction_overview' || $form_id == 'rules_admin_components_overview') {
|
114
|
$form['form_build_id']['#access'] = FALSE;
|
115
|
$form['form_token']['#access'] = FALSE;
|
116
|
$form['form_id']['#access'] = FALSE;
|
117
|
}
|
118
|
}
|
119
|
|
120
|
/**
|
121
|
* Implements hook_system_info_alter().
|
122
|
*
|
123
|
* Adds configuration links for Rules and Rules Scheduler in the modules list.
|
124
|
* (This is done by the Rules UI module, without which there would be no
|
125
|
* configuration pages to visit.)
|
126
|
*/
|
127
|
function rules_admin_system_info_alter(&$info, $file, $type) {
|
128
|
if ($file->name == 'rules') {
|
129
|
$info['configure'] = 'admin/config/workflow/rules';
|
130
|
}
|
131
|
if ($file->name == 'rules_scheduler') {
|
132
|
$info['configure'] = 'admin/config/workflow/rules/schedule';
|
133
|
}
|
134
|
}
|