-
Notifications
You must be signed in to change notification settings - Fork 0
/
word_link.install
178 lines (171 loc) · 3.9 KB
/
word_link.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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
<?php
/**
* @file
* Install, update, and uninstall functions for the word_link module.
*/
/**
* Implements hook_install().
*/
function word_link_install() {
$t = get_t();
drupal_set_message(
$t(
'Word Link module successfully installed. Please configure your text format. Visit the <a href="@link">configuration page</a>.',
array(
'@link' => url('admin/config/content/formats'),
)
)
);
}
/**
* Implements hook_uninstall().
*/
function word_link_uninstall() {
variable_del('word_link_add_css');
variable_del('word_link_defaults_class');
variable_del('word_link_defaults_rel');
variable_del('word_link_defaults_case_sensitive');
variable_del('word_link_defaults_status');
}
/**
* Implements hook_schema().
*/
function word_link_schema() {
$schema['word_link'] = array(
'fields' => array(
'id' => array(
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'text' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'case_sensitive' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 1,
'size' => 'tiny',
),
'url' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'url_title' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => '',
),
'class' => array(
'type' => 'varchar',
'length' => 255,
'not null' => TRUE,
'default' => 'word-link',
),
'visibility' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
),
'except_list' => array(
'type' => 'text',
'not null' => TRUE,
),
'weight' => array(
'description' => 'Weight of the word. Lighter weights are higher up, heavier weights go down.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
),
'rel' => array(
'type' => 'varchar',
'length' => 30,
'not null' => TRUE,
'default' => '',
),
'status' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 1,
'size' => 'tiny',
),
),
'primary key' => array('id'),
);
return $schema;
}
/**
* Adding a visibility column.
*/
function word_link_update_7001() {
if (!db_field_exists('word_link', 'visibility')) {
db_add_field('word_link', 'visibility',
array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'size' => 'tiny',
)
);
}
}
/**
* Adding a weight and rel column.
*/
function word_link_update_7002() {
if (!db_field_exists('word_link', 'weight')) {
db_add_field('word_link', 'weight',
array(
'description' => 'Weight of the word. Lighter weights are higher up, heavier weights go down.',
'type' => 'int',
'not null' => TRUE,
'default' => 0,
)
);
}
if (!db_field_exists('word_link', 'rel')) {
db_add_field('word_link', 'rel',
array(
'type' => 'varchar',
'length' => 30,
'not null' => TRUE,
'default' => '',
)
);
}
}
/**
* Adding a status column.
*/
function word_link_update_7003() {
if (!db_field_exists('word_link', 'status')) {
db_add_field('word_link', 'status',
array(
'type' => 'int',
'not null' => TRUE,
'default' => 1,
'size' => 'tiny',
)
);
}
}
/**
* Rename 'except' field to 'except_list'.
*/
function word_link_update_7004() {
if (!db_field_exists('word_link', 'except_list')) {
$spec = array(
'type' => 'text',
'length' => 255,
'not null' => TRUE,
);
db_change_field('word_link', 'except', 'except_list', $spec);
}
}