-
Notifications
You must be signed in to change notification settings - Fork 1
/
rules_conditional.module
119 lines (106 loc) · 3.26 KB
/
rules_conditional.module
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
<?php
/**
* @file
* Main module file.
*/
/**
* Maximum number of loop iterations (effectively infinite).
*/
define('RULES_CONDITIONAL_MAX_ITERATIONS', 65535);
/**
* Implements hook_rules_ui_menu_alter().
*/
function rules_conditional_rules_ui_menu_alter(&$items, $base_path, $base_count) {
module_load_include('inc', 'rules_conditional', 'includes/rules_conditional.rules_admin');
_rules_conditional_rules_ui_menu_alter($items, $base_path, $base_count);
}
/**
* Creates a conditional.
*/
function rules_conditional() {
return new RulesConditional();
}
/**
* Creates an "if".
*/
function rules_conditional_if($predicate, array $settings = array()) {
return new RulesConditionalIf($predicate, $settings);
}
/**
* Creates an "else".
*/
function rules_conditional_else() {
return new RulesConditionalElse();
}
/**
* Creates a "switch".
*/
function rules_conditional_switch($data_selector) {
return new RulesConditionalSwitch($data_selector);
}
/**
* Creates a "case".
*/
function rules_conditional_case(array $settings = array(), $fall_through = FALSE) {
return new RulesConditionalCase($settings, $fall_through);
}
/**
* Creates a "default case".
*/
function rules_conditional_default_case() {
return new RulesConditionalDefaultCase();
}
/**
* Creates a "while".
*/
function rules_conditional_while($predicate, array $settings = array()) {
return new RulesConditionalWhile($predicate, $settings);
}
/**
* Creates a rule condition set.
*/
function rule_condition_set(array $variables = array()) {
return new RuleConditionSet($variables);
}
/**
* Implements hook_module_implements_alter().
*/
function rules_conditional_module_implements_alter(&$implementations, $hook) {
if ($hook == 'rules_plugin_info') {
$group = $implementations['rules_conditional'];
unset($implementations['rules_conditional']);
$implementations['rules_conditional'] = $group;
}
}
/**
* Implements hook_autoload_info().
*/
function rules_conditional_autoload_info() {
return array(
'RulesConditionalContainer' => 'includes/rules_conditional.core.inc',
'RulesConditionalPluginUI' => 'includes/rules_conditional.ui.inc',
'RulesConditionalEmptyUI' => 'includes/rules_conditional.ui.inc',
'RulesConditionalPredicateUI' => 'includes/rules_conditional.ui.inc',
'RulesConditionalCaseUI' => 'includes/rules_conditional.ui.inc',
'RulesConditionalWhileUI' => 'includes/rules_conditional.ui.inc',
'RuleConditionSetUI' => 'includes/rules_conditional.ui.inc',
'RulesConditional' => 'includes/rules_conditional.plugin.inc',
'RulesConditionalIf' => 'includes/rules_conditional.plugin.inc',
'RulesConditionalElse' => 'includes/rules_conditional.plugin.inc',
'RulesConditionalSwitch' => 'includes/rules_conditional.plugin.inc',
'RulesConditionalCase' => 'includes/rules_conditional.plugin.inc',
'RulesConditionalDefaultCase' => 'includes/rules_conditional.plugin.inc',
'RulesConditionalWhile' => 'includes/rules_conditional.plugin.inc',
'RuleConditionSet' => 'includes/rules_conditional.plugin.inc',
);
}
/**
* Implements hook_config_info().
*/
function rules_conditional_config_info() {
$prefixes['rules_conditional.settings'] = array(
'label' => t('Conditional Rules settings'),
'group' => t('Configuration'),
);
return $prefixes;
}