-
Notifications
You must be signed in to change notification settings - Fork 1
/
nodesinblock.install
114 lines (105 loc) · 2.97 KB
/
nodesinblock.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
<?php
/**
* @file
* Nodes in block install file.
*/
/**
* Implements hook_uninstall().
*/
function nodesinblock_uninstall() {
db_delete('variable')
->condition('name', 'nodesinblock_%', 'LIKE')
->execute();
cache_clear_all('variables', 'cache');
}
/**
* Implements hook_schema().
*/
function nodesinblock_schema() {
$schema['nodesinblock'] = array(
'description' => 'Nodes in block table.',
'fields' => array(
'nid' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'The ID of the node.',
),
'delta' => array(
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'size' => 'tiny',
'description' => 'The delta of the block.',
),
'weight' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'The order of the node in the block.',
),
'visibility' => array(
'type' => 'text',
'not null' => TRUE,
'size' => 'big',
'description' => 'Visibility settings.',
),
'render' => array(
'type' => 'varchar',
'length' => 40,
'not null' => TRUE,
'default' => '',
'description' => 'Render type of node in block, teaser, page or a nd string.',
),
'css_class' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'String containing the classes for the block.',
),
),
'primary key' => array('nid'),
'indexes' => array(
'list' => array('nid', 'delta'),
),
);
return $schema;
}
/**
* Update 6001: Add render field to table.
*/
function nodesinblock_update_6001() {
$ret = array();
db_add_field($ret, 'nodes_in_block', 'render', array('type' => 'int', 'unsigned' => TRUE, 'not null' => TRUE, 'size' => 'tiny', 'default' => 0));
return $ret;
}
/**
* Update 6002: Rename nodes_in_block table to nodesinblock.
*/
function nodesinblock_update_6002() {
$ret = array();
db_rename_table($ret, 'nodes_in_block', 'nodesinblock');
return $ret;
}
/**
* Update 6002: Rename nodes_in_block table to nodesinblock.
*/
function nodesinblock_update_6003() {
$ret = array();
db_drop_field($ret, 'nodesinblock', 'status');
db_change_field($ret, 'nodesinblock', 'render', 'render', array('type' => 'varchar', 'not null' => TRUE, 'length' => 20, 'default' => ''));
return $ret;
}
/**
* Update 7001: Make the render field a bit bigger.
*/
function nodesinblock_update_7001() {
db_change_field('nodesinblock', 'render', 'render', array('type' => 'varchar', 'not null' => TRUE, 'length' => 40, 'default' => ''));
}
/**
* Update 7002: Add field for css class.
*/
function nodesinblock_update_7002() {
db_add_field('nodesinblock', 'css_class', array('type' => 'varchar', 'length' => 255, 'not null' => TRUE, 'default' => '', 'description' => 'String containing the classes for the block.'));
}