-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathiform.install
133 lines (127 loc) · 4.87 KB
/
iform.install
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
127
128
129
130
131
132
133
<?php
/**
* @file
* Install, update, and uninstall functions for the iform module.
*/
/**
* Implementation for hook_schema. Declares the table that is required for storing
* iform data.
*/
function iform_schema() {
$schema['iform'] = array(
'description' => 'Table required for storing Indicia prebuilt form parameters.',
'fields' => array(
'nid' => array(
'description' => 'The primary identifier for a node and therefore an iform instance.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE
),
'iform' => array(
'description' => 'Name of the prebuilt form that is linked to the node.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => ''
),
'params' => array(
'description' => 'JSON structure containing parameters passed to the form on instantiation.',
'type' => 'text',
'not null' => TRUE,
),
'needs_review' => array(
'description' => 'Review state after node import. 0 indicates the node is not imported. ' .
'1 indicates a node that is imported but has been reviewed. 2 indicates that the node ' .
'is imported and site specific settings have been set - it just ' .
'needs a final review. 3 indicates that this is a freshly imported form which may have some ' .
'configuration parameters that are site specific and need review.',
'type' => 'int',
'not null' => TRUE,
'default' => 0
),
'available_for_groups' => array(
'description' => 'Can this page be linked to recording groups?',
'type' => 'int',
'size' => 'tiny',
'not null' => TRUE,
'default' => 0
),
'limit_to_group_id' => array(
'description' => 'If available for recording groups, set the recording group ID here if this form is exclusive to one group.',
'type' => 'int'
),
),
'primary key' => array('nid')
);
return $schema;
}
function iform_install() {
// don't promote iforms to front page by default
variable_set('node_options_iform', array('status'));
// hide author and date info
variable_set('node_submitted_iform', FALSE);
// and default to no comments
variable_set('comment_iform', (module_exists('comment') ? COMMENT_NODE_HIDDEN : 0));
// Don't display date and author information for page nodes by default.
$theme_settings = variable_get('theme_settings', array());
$theme_settings['toggle_node_info_iform'] = FALSE;
variable_set('theme_settings', $theme_settings);
node_types_rebuild();
$type = node_type_get_types();
node_add_body_field($type['iform']);
}
function iform_uninstall() {
variable_del('indicia_website_id');
variable_del('indicia_password');
variable_del('indicia_allow_connection_override');
variable_del('indicia_base_url');
variable_del('indicia_geoserver_url');
variable_del('indicia_max_warehouse_url_length');
variable_del('indicia_elasticsearch_version');
variable_del('indicia_elasticsearch_endpoint');
variable_del('indicia_elasticsearch_user');
variable_del('indicia_elasticsearch_secret');
variable_del('indicia_elasticsearch_warehouse_prefix');
variable_del('indicia_elasticsearch_all_records_permission');
variable_del('indicia_elasticsearch_my_records_permission');
variable_del('indicia_elasticsearch_location_collation_records_permission');
variable_del('indicia_google_api_key');
variable_del('indicia_google_maps_api_key');
variable_del('indicia_bing_api_key');
variable_del('indicia_os_api_key');
// This variable is deprecated but might exist from pre 0.8 installs.
variable_del('indicia_google_search_api_key');
variable_del('indicia_map_centroid_lat');
variable_del('indicia_map_centroid_long');
variable_del('indicia_map_zoom');
variable_del('indicia_spatial_systems');
// This variable is deprecated but might exist from pre 1.54.4 installs.
variable_del('indicia_geoplanet_api_key');
}
/**
* This update adds fields to support recording groups.
*/
function iform_update_7100() {
if (!db_field_exists('iform', 'available_for_groups')) {
$schema = iform_schema();
$spec = $schema['iform']['fields']['available_for_groups'];
db_add_field('iform', 'available_for_groups', $spec);
$spec = $schema['iform']['fields']['limit_to_group_id'];
db_add_field('iform', 'limit_to_group_id', $spec);
return t('New recording group support fields added to the Indicia module');
}
else {
// If upgrading from D6 these may have been added by iform_update_6120
return t('New recording group support fields already exist.');
}
}
/**
* Enable the entity module.
*/
function iform_update_7103() {
$enabled = module_enable(array('entity'));
if (!$enabled) {
throw new DrupalUpdateException('The Entity API module is now required by Indicia. ' .
'Please install and enable this module.');
}
}