-
Notifications
You must be signed in to change notification settings - Fork 1
/
seo_meta.install
186 lines (178 loc) · 4.93 KB
/
seo_meta.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
179
180
181
182
183
184
185
186
<?php
/**
* @file
* SEO Meta Tags install
*/
/**
* Implements hook_requirements().
*/
function seo_meta_requirements($phase) {
// Ensure translations don't break during installation.
$t = get_t();
$requirements = array();
if ($phase == 'install') {
if (module_exists('base_meta')) {
$requirements['base_meta']['description'] = $t('Please disable module "Base Meta: Page Title And Meta Tags" and try again.');
$requirements['base_meta']['severity'] = REQUIREMENT_ERROR;
}
}
return $requirements;
}
/**
* Implements hook_schema().
* Define SQL table for seo_meta
*/
function seo_meta_schema() {
$schema = array();
$schema['seo_meta'] = array(
'description' => 'Table to store meta tags, page titles and path aliases.',
'fields' => array(
'sm_id' => array(
'description' => 'Unique seo meta identifier.',
'type' => 'serial',
'unsigned' => TRUE,
'not null' => TRUE,
),
'ce_type' => array(
'description' => 'Content entry type code, e.g. for homepage, node, view, taxonomy.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
),
'ce_id' => array(
'description' => 'Content entry id, e.g. node nid, view name, taxonomy term.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'path_alias' => array(
'description' => 'Path alias for set meta tags and page title.',
'type' => 'varchar',
'length' => '255',
'not null' => TRUE,
),
'langcode' => array(
'description' => 'The language code of correspond node.',
'type' => 'varchar',
'length' => 32,
'not null' => TRUE,
'default' => '',
),
'page_title' => array(
'description' => 'Page title tag content.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'meta_keywords' => array(
'description' => 'Meta keywords content.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'meta_description' => array(
'description' => 'Meta description content.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'meta_robots' => array(
'description' => 'Meta robots content.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'rel_canonical' => array(
'description' => 'Meta canonical content.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'meta_tw_card' => array(
'description' => 'Twitter card type.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'meta_tw_site' => array(
'description' => 'Twitter @username for the website used in the card footer.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'meta_tw_creator' => array(
'description' => 'Twitter @username for the content creator/author.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'meta_og_type' => array(
'description' => 'Meta Open Graph type.',
'type' => 'varchar',
'length' => '32',
'not null' => FALSE,
),
'meta_og_title' => array(
'description' => 'Meta Open Graph page title.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'meta_og_description' => array(
'description' => 'Meta Open Graph description.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'meta_og_site_name' => array(
'description' => 'Meta Open Graph site name.',
'type' => 'varchar',
'length' => '255',
'not null' => FALSE,
),
'meta_og_image_fid' => array(
'description' => 'Meta Open Graph image fid.',
'type' => 'int',
'not null' => FALSE,
'unsigned' => TRUE,
),
'uid' => array(
'description' => 'Author identifier.',
'type' => 'int',
'unsigned' => TRUE,
'not null' => TRUE,
'default' => 0,
),
'changed' => array(
'type' => 'int',
'not null' => TRUE,
'default' => 0,
'description' => 'Unix timestamp of when last record occurred.',
),
),
'primary key' => array(
'sm_id',
'ce_type',
'ce_id',
'langcode',
),
);
return $schema;
}
/**
* Add and initialize new variable
*/
function seo_meta_update_1000() {
$config = config('seo_meta.settings');
$config->set('use_og_url', 0);
$config->save();
}
/**
* Add and initialize new variable
*/
function seo_meta_update_1001() {
$config = config('seo_meta.settings');
$config->set('excluded_types', []);
$config->save();
}