1 |
85ad3d82
|
Assos Assos
|
<?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 |
73ab1d0a
|
Assos Assos
|
// Make use of the fast, advanced drupal static pattern.
|
24 |
|
|
static $drupal_static_fast;
|
25 |
|
|
if (!isset($drupal_static_fast)) {
|
26 |
|
|
$drupal_static_fast = &drupal_static(__FUNCTION__);
|
27 |
|
|
}
|
28 |
|
|
$modules = &$drupal_static_fast;
|
29 |
|
|
|
30 |
|
|
if (!isset($modules)) {
|
31 |
|
|
$modules = array('data', 'entity', 'node', 'system', 'user', 'rules_core');
|
32 |
|
|
foreach (array('comment', 'taxonomy', 'php', 'path') as $module) {
|
33 |
|
|
if (module_exists($module)) {
|
34 |
|
|
$modules[] = $module;
|
35 |
|
|
}
|
36 |
85ad3d82
|
Assos Assos
|
}
|
37 |
|
|
}
|
38 |
73ab1d0a
|
Assos Assos
|
return $modules;
|
39 |
85ad3d82
|
Assos Assos
|
}
|
40 |
|
|
|
41 |
|
|
/**
|
42 |
|
|
* Returns all items for a hook applying the right module defaults.
|
43 |
|
|
*/
|
44 |
|
|
function _rules_rules_collect_items($hook) {
|
45 |
|
|
$items = array();
|
46 |
|
|
foreach (rules_core_modules() as $module) {
|
47 |
|
|
if (function_exists($function = "rules_{$module}_{$hook}")) {
|
48 |
|
|
$items += (array) $function();
|
49 |
|
|
}
|
50 |
|
|
}
|
51 |
|
|
return $items;
|
52 |
|
|
}
|
53 |
|
|
|
54 |
|
|
/**
|
55 |
|
|
* Implements hook_rules_file_info().
|
56 |
|
|
*/
|
57 |
|
|
function rules_rules_file_info() {
|
58 |
73ab1d0a
|
Assos Assos
|
// Make use of the fast, advanced drupal static pattern.
|
59 |
|
|
static $drupal_static_fast;
|
60 |
|
|
if (!isset($drupal_static_fast)) {
|
61 |
|
|
$drupal_static_fast = &drupal_static(__FUNCTION__);
|
62 |
|
|
}
|
63 |
|
|
$items = &$drupal_static_fast;
|
64 |
|
|
if (!isset($items)) {
|
65 |
|
|
$items = array();
|
66 |
|
|
foreach (rules_core_modules() as $module) {
|
67 |
|
|
if (function_exists($function = "rules_{$module}_file_info")) {
|
68 |
|
|
$items = array_merge($items, (array) $function());
|
69 |
|
|
// Automatically add "$module.rules.inc" for each module.
|
70 |
|
|
$items[] = 'modules/' . $module . '.rules';
|
71 |
|
|
}
|
72 |
85ad3d82
|
Assos Assos
|
}
|
73 |
|
|
}
|
74 |
|
|
return $items;
|
75 |
|
|
}
|
76 |
|
|
|
77 |
|
|
/**
|
78 |
|
|
* Implements hook_rules_category_info().
|
79 |
|
|
*/
|
80 |
|
|
function rules_rules_category_info() {
|
81 |
|
|
return _rules_rules_collect_items('category_info');
|
82 |
|
|
}
|
83 |
|
|
|
84 |
|
|
/**
|
85 |
|
|
* Implements hook_rules_action_info().
|
86 |
|
|
*/
|
87 |
|
|
function rules_rules_action_info() {
|
88 |
|
|
return _rules_rules_collect_items('action_info');
|
89 |
|
|
}
|
90 |
|
|
|
91 |
|
|
/**
|
92 |
|
|
* Implements hook_rules_condition_info().
|
93 |
|
|
*/
|
94 |
|
|
function rules_rules_condition_info() {
|
95 |
|
|
return _rules_rules_collect_items('condition_info');
|
96 |
|
|
}
|
97 |
|
|
|
98 |
|
|
/**
|
99 |
|
|
* Implements hook_rules_event_info().
|
100 |
|
|
*/
|
101 |
|
|
function rules_rules_event_info() {
|
102 |
|
|
return _rules_rules_collect_items('event_info');
|
103 |
|
|
}
|
104 |
|
|
|
105 |
|
|
/**
|
106 |
|
|
* Implements hook_rules_data_info().
|
107 |
|
|
*/
|
108 |
|
|
function rules_rules_data_info() {
|
109 |
|
|
return _rules_rules_collect_items('data_info');
|
110 |
|
|
}
|
111 |
|
|
|
112 |
|
|
/**
|
113 |
|
|
* Implements hook_rules_data_info_alter().
|
114 |
|
|
*/
|
115 |
|
|
function rules_rules_data_info_alter(&$items) {
|
116 |
|
|
// For now just invoke the rules core implementation manually.
|
117 |
|
|
rules_rules_core_data_info_alter($items);
|
118 |
|
|
}
|
119 |
|
|
|
120 |
|
|
/**
|
121 |
|
|
* Implements hook_rules_evaluator_info().
|
122 |
|
|
*/
|
123 |
|
|
function rules_rules_evaluator_info() {
|
124 |
|
|
return _rules_rules_collect_items('evaluator_info');
|
125 |
|
|
}
|
126 |
|
|
|
127 |
|
|
/**
|
128 |
|
|
* Implements hook_rules_data_processor_info().
|
129 |
|
|
*/
|
130 |
|
|
function rules_rules_data_processor_info() {
|
131 |
|
|
return _rules_rules_collect_items('data_processor_info');
|
132 |
|
|
} |