-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebform_remote_post.install
More file actions
126 lines (116 loc) · 3.18 KB
/
webform_remote_post.install
File metadata and controls
126 lines (116 loc) · 3.18 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
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
120
121
122
123
124
125
126
<?php
/**
* @file
* Module install/schema hooks.
*/
/**
* Implements hook_schema().
*/
function webform_remote_post_schema() {
$schema = array();
$schema['webform_remote_post_targets'] = array(
'description' => 'Holds information regarding submission forwards that should be sent for each valid form submission',
'fields' => array(
'nid' => array(
'description' => 'The node identifier of a webform.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'tid' => array(
'description' => 'The URL target identifier.',
'type' => 'int',
'unsigned' => TRUE,
'size' => 'small',
'not null' => TRUE,
'default' => 0,
),
'url' => array(
'description' => 'The http address that will be used to post upon submission.',
'type' => 'text',
'not null' => TRUE,
),
'label' => array(
'description' => 'The label given to the URL target that we are posting to.',
'type' => 'text',
'not null' => FALSE,
),
'enabled' => array(
'description' => 'Should we post to this target?',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
),
'type' => array(
'description' => 'The type of content to send remotely.',
'type' => 'text',
'not null' => FALSE,
),
'mode' => array(
'description' => 'POST pre or post save?',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
),
'extra' => array(
'description' => 'Extra fields to include in POST.',
'type' => 'text',
'not null' => FALSE,
),
'referer' => array(
'description' => 'Value for the Referer header. $GLOBALS[\'base_url\'] will be used if this is left blank.',
'type' => 'text',
'not null' => FALSE
)
),
'primary key' => array('nid', 'tid'),
);
return $schema;
}
/**
* First update for the post type
*/
function webform_remote_post_update_7100(&$sandbox) {
$new_field = array(
'description' => 'The type of content to send remotely.',
'type' => 'text',
'not null' => FALSE,
);
db_add_field('webform_remote_post_targets', 'type', $new_field);
}
/**
* Add mode and extra fields
*/
function webform_remote_post_update_7200() {
$new_fields = array(
'mode' => array(
'description' => 'POST pre or post save?',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 1,
),
'extra' => array(
'description' => 'Extra fields to include in POST.',
'type' => 'text',
'not null' => FALSE,
),
);
foreach ($new_fields as $field => $schema) {
db_add_field('webform_remote_post_targets', $field, $schema);
}
}
/**
* Add referer
*/
function webform_remote_post_update_7210() {
$new_field = array(
'description' => 'Value for the Referer header. $GLOBALS[\'base_url\'] will be used if this is left blank.',
'type' => 'text',
'not null' => FALSE,
);
db_add_field('webform_remote_post_targets', 'referer', $new_field);
}