-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrules_forms.install
More file actions
60 lines (53 loc) · 1.75 KB
/
rules_forms.install
File metadata and controls
60 lines (53 loc) · 1.75 KB
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
<?php
/**
* @file
* Installation function for Rules Forms module.
*/
/**
* Implements hook_install().
*/
function rules_forms_install() {
// Set the modules' weight to 20, because we want it to be the last one using
// hook_form_alter().
db_query("UPDATE {system} SET weight = 20 WHERE name = 'rules_forms'");
// Notify the user of configuration requirements for Rules Forms.
drupal_set_message(st('You may now <a href="!rules_forms_settings">enable Rules Forms rules</a> '.
'for individual forms. For more information please consult the documentation '.
'in README.txt in your Rules forms support module folder.',
array('!rules_forms_settings' => url(RULES_FORMS_ADMIN_PATH))), 'status');
}
/**
* Implements hook_uninstall().
*/
function rules_forms_uninstall() {
variable_del('rules_forms_form_info');
}
/**
* Deletes the old variable.
*/
function rules_forms_update_7101() {
variable_del('rules_forms_events');
}
/**
* See http://drupal.org/node/1447328#comment-5640172
* Unset rules_forms_event_info array values with empty keys to
* cleanse the settings array of bad form information.
*/
function rules_forms_update_7102() {
$event_info = variable_get('rules_forms_event_info', array());
foreach ($event_info as $key => $value) {
// Any form of empty key is unwanted (NULL, 0, FALSE, '', etc).
if (empty($key)) {
unset($event_info[$key]);
}
}
variable_set('rules_forms_event_info', $event_info);
}
/**
* Change Rules Forms settings variable name.
*/
function rules_forms_update_7103() {
$form_info = variable_get('rules_forms_event_info', array());
variable_set('rules_forms_form_info', $form_info);
variable_del('rules_forms_event_info');
}