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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
|
<?php
/**
* @file
* Display Suite install file.
*/
/**
* Implements hook_install().
*/
function ds_install() {
db_update('system')
->fields(array('weight' => 1))
->condition('name', 'ds')
->execute();
}
/**
* Implements hook_uninstall().
*/
function ds_uninstall() {
variable_del('ds_classes_regions');
}
/**
* Implements hook_schema().
*/
function ds_schema() {
$schema['ds_field_settings'] = array(
'description' => 'The table that holds Display Suite field settings per display.',
// CTools export definitions.
'export' => array(
'key' => 'id',
'identifier' => 'ds_fieldsetting',
'default hook' => 'ds_field_settings_info',
'can disable' => FALSE,
'api' => array(
'owner' => 'ds',
'api' => 'ds',
'minimum_version' => 1,
'current_version' => 1,
),
),
'fields' => array(
'id' => array(
'description' => 'The unique id this setting.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'entity_type' => array(
'description' => 'The name of the entity.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'bundle' => array(
'description' => 'The name of the entity.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'view_mode' => array(
'description' => 'The name of the view_mode.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'settings' => array(
'description' => 'The Display Suite field settings for this layout.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
),
),
'primary key' => array('id'),
'indexes' => array(
'ds_entity' => array('entity_type'),
'ds_bundle' => array('bundle'),
'ds_view_mode' => array('view_mode'),
),
);
$schema['ds_layout_settings'] = array(
'description' => 'The table that holds the layouts configuration.',
// CTools export definitions.
'export' => array(
'key' => 'id',
'identifier' => 'ds_layout',
'default hook' => 'ds_layout_settings_info',
'can disable' => FALSE,
'api' => array(
'owner' => 'ds',
'api' => 'ds',
'minimum_version' => 1,
'current_version' => 1,
),
),
'fields' => array(
'id' => array(
'description' => 'The unique id the layout.',
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'entity_type' => array(
'description' => 'The name of the entity.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'bundle' => array(
'description' => 'The name of the entity.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'view_mode' => array(
'description' => 'The name of the view_mode.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'layout' => array(
'description' => 'The name of the layout.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'settings' => array(
'description' => 'The settings for this layout.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
),
),
'primary key' => array('id'),
'indexes' => array(
'ds_entity' => array('entity_type'),
'ds_bundle' => array('bundle'),
'ds_view_mode' => array('view_mode'),
),
);
$schema['ds_view_modes'] = array(
'description' => 'The table that holds custom view modes managed by Display Suite.',
// CTools export definitions.
'export' => array(
'key' => 'view_mode',
'identifier' => 'ds_view_mode',
'default hook' => 'ds_view_modes_info',
'can disable' => FALSE,
'api' => array(
'owner' => 'ds',
'api' => 'ds',
'minimum_version' => 1,
'current_version' => 1,
),
),
'fields' => array(
'view_mode' => array(
'description' => 'The machine name of the view mode.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
),
'label' => array(
'description' => 'The label of the view mode.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'entities' => array(
'description' => 'The entities for this view mode.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
),
),
'primary key' => array('view_mode'),
);
$schema['ds_fields'] = array(
'description' => 'The table that holds custom fields managed by Display Suite.',
// CTools export definitions.
'export' => array(
'key' => 'field',
'identifier' => 'ds_field',
'default hook' => 'ds_custom_fields_info',
'can disable' => FALSE,
'api' => array(
'owner' => 'ds',
'api' => 'ds',
'minimum_version' => 1,
'current_version' => 1,
),
),
'fields' => array(
'field' => array(
'description' => 'The machine name of the field.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'label' => array(
'description' => 'The label of the field.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
),
'field_type' => array(
'description' => 'The type of of the field',
'type' => 'int',
'size' => 'small',
'not null' => TRUE,
'default' => 0,
),
'entities' => array(
'description' => 'The entities for this field.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
),
'ui_limit' => array(
'description' => 'The UI limit for this field.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
),
'properties' => array(
'description' => 'The properties for this field.',
'type' => 'blob',
'not null' => FALSE,
'size' => 'big',
'serialize' => TRUE,
),
),
'primary key' => array('field'),
);
return $schema;
}
/**
* Add the ui_limit table to the fields table.
*/
function ds_update_7201() {
$schema = ds_schema();
if (!db_field_exists('ds_fields', 'ui_limit')) {
db_add_field('ds_fields', 'ui_limit', $schema['ds_fields']['fields']['ui_limit']);
}
}
/**
* Increase the label storage length to 128.
*/
function ds_update_7202() {
db_change_field('ds_fields', 'label', 'label',
array(
'description' => 'The label of the field.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
));
}
/**
* Increase the view_mode storage length to 64
*/
function ds_update_7203() {
db_change_field('ds_field_settings', 'view_mode', 'view_mode',
array(
'description' => 'The name of the view_mode.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
)
);
db_change_field('ds_layout_settings', 'view_mode', 'view_mode',
array(
'description' => 'The name of the view_mode.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
)
);
db_change_field('ds_view_modes', 'view_mode', 'view_mode',
array(
'description' => 'The machine name of the view mode.',
'type' => 'varchar',
'length' => 64,
'not null' => TRUE,
'default' => '',
)
);
}
|