forked from backdrop-contrib/conditional_fields
-
Notifications
You must be signed in to change notification settings - Fork 0
/
conditional_fields.install
72 lines (68 loc) · 1.9 KB
/
conditional_fields.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
<?php
/**
* @file
* Install, update and uninstall functions for the Conditional Fields module.
*/
/**
* Implements hook_schema().
*/
function conditional_fields_schema() {
$schema['conditional_fields'] = array(
'description' => 'Stores dependencies between fields.',
'fields' => array(
'id' => array(
'type' => 'serial',
'not null' => TRUE,
'description' => 'The primary identifier for a dependency.',
),
'dependee' => array(
'type' => 'varchar',
'not null' => TRUE,
'length' => 128,
'description' => 'The id of the dependee field instance.',
),
'dependent' => array(
'type' => 'varchar',
'not null' => TRUE,
'length' => 128,
'description' => 'The id of the dependent field instance.',
),
'options' => array(
'type' => 'blob',
'size' => 'big',
'not null' => TRUE,
'serialize' => TRUE,
'description' => 'Serialized data containing the options for the dependency.',
),
),
'primary key' => array('id'),
);
return $schema;
}
/**
* Implements hook_update_last_removed().
*/
function conditional_fields_update_last_removed() {
return 7002;
}
/**
* Adjust schema for new `entity_type.bundle.field_name` ID types (rather than
* numeric IDs which Backdrop does not use).
*/
function conditional_fields_update_1000() {
$config = config('conditional_fields.settings');
db_change_field('conditional_fields', 'dependee', 'dependee', array(
'description' => 'The id of the dependee field instance.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
));
db_change_field('conditional_fields', 'dependent', 'dependent', array(
'description' => 'The id of the dependent field instance.',
'type' => 'varchar',
'length' => 128,
'not null' => TRUE,
'default' => '',
));
}