1
|
<?php
|
2
|
|
3
|
/**
|
4
|
* @file
|
5
|
* Display Suite install file.
|
6
|
*/
|
7
|
|
8
|
/**
|
9
|
* Implements hook_install().
|
10
|
*/
|
11
|
function ds_install() {
|
12
|
db_update('system')
|
13
|
->fields(array('weight' => 1))
|
14
|
->condition('name', 'ds')
|
15
|
->execute();
|
16
|
}
|
17
|
|
18
|
/**
|
19
|
* Implements hook_uninstall().
|
20
|
*/
|
21
|
function ds_uninstall() {
|
22
|
variable_del('ds_classes_regions');
|
23
|
variable_del('ds_disable');
|
24
|
variable_del('ds_extras_region_blocks');
|
25
|
variable_del('menu_rebuild_needed');
|
26
|
}
|
27
|
|
28
|
/**
|
29
|
* Implements hook_schema().
|
30
|
*/
|
31
|
function ds_schema() {
|
32
|
|
33
|
$schema['ds_field_settings'] = array(
|
34
|
'description' => 'The table that holds Display Suite field settings per display.',
|
35
|
|
36
|
// CTools export definitions.
|
37
|
'export' => array(
|
38
|
'key' => 'id',
|
39
|
'identifier' => 'ds_fieldsetting',
|
40
|
'default hook' => 'ds_field_settings_info',
|
41
|
'can disable' => FALSE,
|
42
|
'api' => array(
|
43
|
'owner' => 'ds',
|
44
|
'api' => 'ds',
|
45
|
'minimum_version' => 1,
|
46
|
'current_version' => 1,
|
47
|
),
|
48
|
),
|
49
|
|
50
|
'fields' => array(
|
51
|
'id' => array(
|
52
|
'description' => 'The unique id this setting.',
|
53
|
'type' => 'varchar',
|
54
|
'length' => 255,
|
55
|
'not null' => TRUE,
|
56
|
'default' => '',
|
57
|
),
|
58
|
'entity_type' => array(
|
59
|
'description' => 'The name of the entity.',
|
60
|
'type' => 'varchar',
|
61
|
'length' => 32,
|
62
|
'not null' => TRUE,
|
63
|
'default' => '',
|
64
|
),
|
65
|
'bundle' => array(
|
66
|
'description' => 'The name of the entity.',
|
67
|
'type' => 'varchar',
|
68
|
'length' => 64,
|
69
|
'not null' => TRUE,
|
70
|
'default' => '',
|
71
|
),
|
72
|
'view_mode' => array(
|
73
|
'description' => 'The name of the view_mode.',
|
74
|
'type' => 'varchar',
|
75
|
'length' => 64,
|
76
|
'not null' => TRUE,
|
77
|
'default' => '',
|
78
|
),
|
79
|
'settings' => array(
|
80
|
'description' => 'The Display Suite field settings for this layout.',
|
81
|
'type' => 'blob',
|
82
|
'not null' => FALSE,
|
83
|
'size' => 'big',
|
84
|
'serialize' => TRUE,
|
85
|
),
|
86
|
),
|
87
|
'primary key' => array('id'),
|
88
|
'indexes' => array(
|
89
|
'ds_entity' => array('entity_type'),
|
90
|
'ds_bundle' => array('bundle'),
|
91
|
'ds_view_mode' => array('view_mode'),
|
92
|
),
|
93
|
);
|
94
|
|
95
|
$schema['ds_layout_settings'] = array(
|
96
|
'description' => 'The table that holds the layouts configuration.',
|
97
|
|
98
|
// CTools export definitions.
|
99
|
'export' => array(
|
100
|
'key' => 'id',
|
101
|
'identifier' => 'ds_layout',
|
102
|
'default hook' => 'ds_layout_settings_info',
|
103
|
'can disable' => FALSE,
|
104
|
'api' => array(
|
105
|
'owner' => 'ds',
|
106
|
'api' => 'ds',
|
107
|
'minimum_version' => 1,
|
108
|
'current_version' => 1,
|
109
|
),
|
110
|
),
|
111
|
|
112
|
'fields' => array(
|
113
|
'id' => array(
|
114
|
'description' => 'The unique id the layout.',
|
115
|
'type' => 'varchar',
|
116
|
'length' => 255,
|
117
|
'not null' => TRUE,
|
118
|
'default' => '',
|
119
|
),
|
120
|
'entity_type' => array(
|
121
|
'description' => 'The name of the entity.',
|
122
|
'type' => 'varchar',
|
123
|
'length' => 32,
|
124
|
'not null' => TRUE,
|
125
|
'default' => '',
|
126
|
),
|
127
|
'bundle' => array(
|
128
|
'description' => 'The name of the entity.',
|
129
|
'type' => 'varchar',
|
130
|
'length' => 64,
|
131
|
'not null' => TRUE,
|
132
|
'default' => '',
|
133
|
),
|
134
|
'view_mode' => array(
|
135
|
'description' => 'The name of the view_mode.',
|
136
|
'type' => 'varchar',
|
137
|
'length' => 64,
|
138
|
'not null' => TRUE,
|
139
|
'default' => '',
|
140
|
),
|
141
|
'layout' => array(
|
142
|
'description' => 'The name of the layout.',
|
143
|
'type' => 'varchar',
|
144
|
'length' => 64,
|
145
|
'not null' => TRUE,
|
146
|
'default' => '',
|
147
|
),
|
148
|
'settings' => array(
|
149
|
'description' => 'The settings for this layout.',
|
150
|
'type' => 'blob',
|
151
|
'not null' => FALSE,
|
152
|
'size' => 'big',
|
153
|
'serialize' => TRUE,
|
154
|
),
|
155
|
),
|
156
|
'primary key' => array('id'),
|
157
|
'indexes' => array(
|
158
|
'ds_entity' => array('entity_type'),
|
159
|
'ds_bundle' => array('bundle'),
|
160
|
'ds_view_mode' => array('view_mode'),
|
161
|
),
|
162
|
);
|
163
|
|
164
|
$schema['ds_view_modes'] = array(
|
165
|
'description' => 'The table that holds custom view modes managed by Display Suite.',
|
166
|
|
167
|
// CTools export definitions.
|
168
|
'export' => array(
|
169
|
'key' => 'view_mode',
|
170
|
'identifier' => 'ds_view_mode',
|
171
|
'default hook' => 'ds_view_modes_info',
|
172
|
'can disable' => FALSE,
|
173
|
'api' => array(
|
174
|
'owner' => 'ds',
|
175
|
'api' => 'ds',
|
176
|
'minimum_version' => 1,
|
177
|
'current_version' => 1,
|
178
|
),
|
179
|
),
|
180
|
|
181
|
'fields' => array(
|
182
|
'view_mode' => array(
|
183
|
'description' => 'The machine name of the view mode.',
|
184
|
'type' => 'varchar',
|
185
|
'length' => 64,
|
186
|
'not null' => TRUE,
|
187
|
'default' => '',
|
188
|
),
|
189
|
'label' => array(
|
190
|
'description' => 'The label of the view mode.',
|
191
|
'type' => 'varchar',
|
192
|
'length' => 32,
|
193
|
'not null' => TRUE,
|
194
|
'default' => '',
|
195
|
),
|
196
|
'entities' => array(
|
197
|
'description' => 'The entities for this view mode.',
|
198
|
'type' => 'blob',
|
199
|
'not null' => FALSE,
|
200
|
'size' => 'big',
|
201
|
'serialize' => TRUE,
|
202
|
),
|
203
|
),
|
204
|
'primary key' => array('view_mode'),
|
205
|
);
|
206
|
|
207
|
$schema['ds_fields'] = array(
|
208
|
'description' => 'The table that holds custom fields managed by Display Suite.',
|
209
|
|
210
|
// CTools export definitions.
|
211
|
'export' => array(
|
212
|
'key' => 'field',
|
213
|
'identifier' => 'ds_field',
|
214
|
'default hook' => 'ds_custom_fields_info',
|
215
|
'can disable' => FALSE,
|
216
|
'api' => array(
|
217
|
'owner' => 'ds',
|
218
|
'api' => 'ds',
|
219
|
'minimum_version' => 1,
|
220
|
'current_version' => 1,
|
221
|
),
|
222
|
),
|
223
|
|
224
|
'fields' => array(
|
225
|
'field' => array(
|
226
|
'description' => 'The machine name of the field.',
|
227
|
'type' => 'varchar',
|
228
|
'length' => 32,
|
229
|
'not null' => TRUE,
|
230
|
'default' => '',
|
231
|
),
|
232
|
'label' => array(
|
233
|
'description' => 'The label of the field.',
|
234
|
'type' => 'varchar',
|
235
|
'length' => 128,
|
236
|
'not null' => TRUE,
|
237
|
'default' => '',
|
238
|
),
|
239
|
'field_type' => array(
|
240
|
'description' => 'The type of of the field',
|
241
|
'type' => 'int',
|
242
|
'size' => 'small',
|
243
|
'not null' => TRUE,
|
244
|
'default' => 0,
|
245
|
),
|
246
|
'entities' => array(
|
247
|
'description' => 'The entities for this field.',
|
248
|
'type' => 'blob',
|
249
|
'not null' => FALSE,
|
250
|
'size' => 'big',
|
251
|
'serialize' => TRUE,
|
252
|
),
|
253
|
'ui_limit' => array(
|
254
|
'description' => 'The UI limit for this field.',
|
255
|
'type' => 'blob',
|
256
|
'not null' => FALSE,
|
257
|
'size' => 'big',
|
258
|
'serialize' => TRUE,
|
259
|
),
|
260
|
'properties' => array(
|
261
|
'description' => 'The properties for this field.',
|
262
|
'type' => 'blob',
|
263
|
'not null' => FALSE,
|
264
|
'size' => 'big',
|
265
|
'serialize' => TRUE,
|
266
|
),
|
267
|
),
|
268
|
'primary key' => array('field'),
|
269
|
);
|
270
|
|
271
|
return $schema;
|
272
|
}
|
273
|
|
274
|
/**
|
275
|
* Add the ui_limit table to the fields table.
|
276
|
*/
|
277
|
function ds_update_7201() {
|
278
|
$schema = ds_schema();
|
279
|
if (!db_field_exists('ds_fields', 'ui_limit')) {
|
280
|
db_add_field('ds_fields', 'ui_limit', $schema['ds_fields']['fields']['ui_limit']);
|
281
|
}
|
282
|
}
|
283
|
|
284
|
/**
|
285
|
* Increase the label storage length to 128.
|
286
|
*/
|
287
|
function ds_update_7202() {
|
288
|
db_change_field('ds_fields', 'label', 'label',
|
289
|
array(
|
290
|
'description' => 'The label of the field.',
|
291
|
'type' => 'varchar',
|
292
|
'length' => 128,
|
293
|
'not null' => TRUE,
|
294
|
'default' => '',
|
295
|
));
|
296
|
}
|
297
|
|
298
|
|
299
|
/**
|
300
|
* Increase the view_mode storage length to 64
|
301
|
*/
|
302
|
function ds_update_7203() {
|
303
|
db_change_field('ds_field_settings', 'view_mode', 'view_mode',
|
304
|
array(
|
305
|
'description' => 'The name of the view_mode.',
|
306
|
'type' => 'varchar',
|
307
|
'length' => 64,
|
308
|
'not null' => TRUE,
|
309
|
'default' => '',
|
310
|
)
|
311
|
);
|
312
|
db_change_field('ds_layout_settings', 'view_mode', 'view_mode',
|
313
|
array(
|
314
|
'description' => 'The name of the view_mode.',
|
315
|
'type' => 'varchar',
|
316
|
'length' => 64,
|
317
|
'not null' => TRUE,
|
318
|
'default' => '',
|
319
|
)
|
320
|
);
|
321
|
db_change_field('ds_view_modes', 'view_mode', 'view_mode',
|
322
|
array(
|
323
|
'description' => 'The machine name of the view mode.',
|
324
|
'type' => 'varchar',
|
325
|
'length' => 64,
|
326
|
'not null' => TRUE,
|
327
|
'default' => '',
|
328
|
)
|
329
|
);
|
330
|
}
|