1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file Includes any rules integration provided by the module.
|
5
|
*/
|
6
|
|
7
|
/**
|
8
|
* Load all module includes as soon as this file gets included, which is done
|
9
|
* automatically by module_implements().
|
10
|
*/
|
11
|
foreach (rules_core_modules() as $module) {
|
12
|
module_load_include('inc', 'rules', "modules/$module.rules");
|
13
|
}
|
14
|
|
15
|
/**
|
16
|
* Defines a list of core module on whose behalf we provide module integration.
|
17
|
*
|
18
|
* We also add a pseudo 'data' module, which will be used for providing generic
|
19
|
* rules data integration, 'entity' for entity-related integration and 'rules'
|
20
|
* for providing some general stuff.
|
21
|
*/
|
22
|
function rules_core_modules() {
|
23
|
$return = array('data', 'entity', 'node', 'system', 'user', 'rules_core');
|
24
|
foreach (array('comment', 'taxonomy', 'php', 'path') as $module) {
|
25
|
if (module_exists($module)) {
|
26
|
$return[] = $module;
|
27
|
}
|
28
|
}
|
29
|
return $return;
|
30
|
}
|
31
|
|
32
|
/**
|
33
|
* Returns all items for a hook applying the right module defaults.
|
34
|
*/
|
35
|
function _rules_rules_collect_items($hook) {
|
36
|
$items = array();
|
37
|
foreach (rules_core_modules() as $module) {
|
38
|
if (function_exists($function = "rules_{$module}_{$hook}")) {
|
39
|
$items += (array) $function();
|
40
|
}
|
41
|
}
|
42
|
return $items;
|
43
|
}
|
44
|
|
45
|
/**
|
46
|
* Implements hook_rules_file_info().
|
47
|
*/
|
48
|
function rules_rules_file_info() {
|
49
|
$items = array();
|
50
|
foreach (rules_core_modules() as $module) {
|
51
|
if (function_exists($function = "rules_{$module}_file_info")) {
|
52
|
$items = array_merge($items, (array)$function());
|
53
|
// Automatically add "$module.rules.inc" for each module.
|
54
|
$items[] = 'modules/' . $module . '.rules';
|
55
|
}
|
56
|
}
|
57
|
return $items;
|
58
|
}
|
59
|
|
60
|
/**
|
61
|
* Implements hook_rules_category_info().
|
62
|
*/
|
63
|
function rules_rules_category_info() {
|
64
|
return _rules_rules_collect_items('category_info');
|
65
|
}
|
66
|
|
67
|
/**
|
68
|
* Implements hook_rules_action_info().
|
69
|
*/
|
70
|
function rules_rules_action_info() {
|
71
|
return _rules_rules_collect_items('action_info');
|
72
|
}
|
73
|
|
74
|
/**
|
75
|
* Implements hook_rules_condition_info().
|
76
|
*/
|
77
|
function rules_rules_condition_info() {
|
78
|
return _rules_rules_collect_items('condition_info');
|
79
|
}
|
80
|
|
81
|
/**
|
82
|
* Implements hook_rules_event_info().
|
83
|
*/
|
84
|
function rules_rules_event_info() {
|
85
|
return _rules_rules_collect_items('event_info');
|
86
|
}
|
87
|
|
88
|
/**
|
89
|
* Implements hook_rules_data_info().
|
90
|
*/
|
91
|
function rules_rules_data_info() {
|
92
|
return _rules_rules_collect_items('data_info');
|
93
|
}
|
94
|
|
95
|
/**
|
96
|
* Implements hook_rules_data_info_alter().
|
97
|
*/
|
98
|
function rules_rules_data_info_alter(&$items) {
|
99
|
// For now just invoke the rules core implementation manually.
|
100
|
rules_rules_core_data_info_alter($items);
|
101
|
}
|
102
|
|
103
|
/**
|
104
|
* Implements hook_rules_evaluator_info().
|
105
|
*/
|
106
|
function rules_rules_evaluator_info() {
|
107
|
return _rules_rules_collect_items('evaluator_info');
|
108
|
}
|
109
|
|
110
|
/**
|
111
|
* Implements hook_rules_data_processor_info().
|
112
|
*/
|
113
|
function rules_rules_data_processor_info() {
|
114
|
return _rules_rules_collect_items('data_processor_info');
|
115
|
}
|