-
Notifications
You must be signed in to change notification settings - Fork 0
/
custom_pagers.install
162 lines (153 loc) · 4.97 KB
/
custom_pagers.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
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
<?php
// $Id: custom_pagers.install,v 1.3.2.4 2010/01/17 22:14:21 eaton Exp $
/**
* @file
* Custom pagers install file.
*/
/**
* Implements hook_install().
*/
function custom_pagers_install() {
// TODO The drupal_(un)install_schema functions are called automatically in D7.
// drupal_install_schema('custom_pagers')
}
/**
* @todo Please document this function.
* @see http://drupal.org/node/1354
*/
function custom_pagers_schema() {
$schema['custom_pager'] = array(
'description' => 'Stores data for previous/next pagers to be added to nodes.',
'fields' => array(
'pid' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
'description' => 'Unique identifier for the {custom_pager}.',
),
'title' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The visible title of the {custom_pager}.',
),
'list_php' => array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
'description' => 'Raw PHP to populate this {custom_pager}.',
),
'view' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'The name of the view used for this {custom_pager}.',
),
'args' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => "A serialized array of arguments for the {custom_pager}'s view.",
),
'position' => array(
'type' => 'varchar',
'length' => 16,
'not null' => TRUE,
'default' => '',
'description' => 'The position where this {custom_pager} should be displayed.',
),
'visibility_php' => array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
'description' => 'Raw PHP to determine when the {custom_pager} should be displayed.',
),
'node_type' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
'description' => 'A specific node type this {custom_pager} should be displayed with.',
),
'reverse_list' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => 'A boolean flag indicating that this {custom_pager} should be displayed in reverse order.',
),
),
'primary key' => array('pid'),
);
return $schema;
}
/**
* @todo Please document this function.
* @see http://drupal.org/node/1354
*/
function custom_pagers_update_1() {
$ret = array();
db_add_field('custom_pager', 'list_php', array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
'description' => 'Raw PHP to populate this {custom_pager}.',
));
db_add_field('custom_pager', 'visibility_php', array(
'type' => 'text',
'not null' => FALSE,
'size' => 'big',
'description' => 'Raw PHP to determine when the {custom_pager} should be displayed.',
));
// hook_update_N() no longer returns a $ret array. Instead, return
// nothing or a translated string indicating the update ran successfully.
// See http://drupal.org/node/224333#update_sql.
return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
}
/**
* @todo Please document this function.
* @see http://drupal.org/node/1354
*/
function custom_pagers_update_2() {
$ret = array();
db_add_field('custom_pager', 'cache_list', array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => "A boolean flag indicating that this {custom_pager}'s list of nodes should be cached.",
));
db_add_field('custom_pager', 'reverse_list', array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
'description' => 'A boolean flag indicating that this {custom_pager} should be displayed in reverse order.',
));
// hook_update_N() no longer returns a $ret array. Instead, return
// nothing or a translated string indicating the update ran successfully.
// See http://drupal.org/node/224333#update_sql.
return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
}
/**
* Kill the cache flag as it's not actually that helpful.
*/
function custom_pagers_update_6104() {
$ret = array();
db_drop_field('custom_pager', 'cache_list');
// hook_update_N() no longer returns a $ret array. Instead, return
// nothing or a translated string indicating the update ran successfully.
// See http://drupal.org/node/224333#update_sql.
return t('TODO Add a descriptive string here to show in the UI.') /* $ret */;
}
/**
* @todo Please document this function.
* @see http://drupal.org/node/1354
*/
function custom_pagers_uninstall() {
// TODO The drupal_(un)install_schema functions are called automatically in D7.
// drupal_uninstall_schema('custom_pagers')
}