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