Projet

Général

Profil

Paste
Télécharger (2,83 ko) Statistiques
| Branche: | Révision:

root / drupal7 / sites / all / modules / rules / rules.rules.inc @ 74f6bef0

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
  module_load_include('inc', 'rules', 'modules/events');
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
  $return = array('data', 'entity', 'node', 'system', 'user', 'rules_core');
25
  foreach (array('comment', 'taxonomy', 'php', 'path') as $module) {
26
    if (module_exists($module)) {
27
      $return[] = $module;
28
    }
29
  }
30
  return $return;
31
}
32

    
33
/**
34
 * Returns all items for a hook applying the right module defaults.
35
 */
36
function _rules_rules_collect_items($hook) {
37
  $items = array();
38
  foreach (rules_core_modules() as $module) {
39
    if (function_exists($function = "rules_{$module}_{$hook}")) {
40
      $items += (array) $function();
41
    }
42
  }
43
  return $items;
44
}
45

    
46
/**
47
 * Implements hook_rules_file_info().
48
 */
49
function rules_rules_file_info() {
50
  $items = array();
51
  foreach (rules_core_modules() as $module) {
52
    if (function_exists($function = "rules_{$module}_file_info")) {
53
      $items = array_merge($items, (array)$function());
54
      // Automatically add "$module.rules.inc" for each module.
55
      $items[] = 'modules/' . $module . '.rules';
56
    }
57
  }
58
  return $items;
59
}
60

    
61
/**
62
 * Implements hook_rules_category_info().
63
 */
64
function rules_rules_category_info() {
65
  return _rules_rules_collect_items('category_info');
66
}
67

    
68
/**
69
 * Implements hook_rules_action_info().
70
 */
71
function rules_rules_action_info() {
72
  return _rules_rules_collect_items('action_info');
73
}
74

    
75
/**
76
 * Implements hook_rules_condition_info().
77
 */
78
function rules_rules_condition_info() {
79
  return _rules_rules_collect_items('condition_info');
80
}
81

    
82
/**
83
 * Implements hook_rules_event_info().
84
 */
85
function rules_rules_event_info() {
86
  return _rules_rules_collect_items('event_info');
87
}
88

    
89
/**
90
 * Implements hook_rules_data_info().
91
 */
92
function rules_rules_data_info() {
93
  return _rules_rules_collect_items('data_info');
94
}
95

    
96
/**
97
 * Implements hook_rules_data_info_alter().
98
 */
99
function rules_rules_data_info_alter(&$items) {
100
  // For now just invoke the rules core implementation manually.
101
  rules_rules_core_data_info_alter($items);
102
}
103

    
104
/**
105
 * Implements hook_rules_evaluator_info().
106
 */
107
function rules_rules_evaluator_info() {
108
  return _rules_rules_collect_items('evaluator_info');
109
}
110

    
111
/**
112
 * Implements hook_rules_data_processor_info().
113
 */
114
function rules_rules_data_processor_info() {
115
  return _rules_rules_collect_items('data_processor_info');
116
}