-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathding_language.install
More file actions
81 lines (70 loc) · 2 KB
/
ding_language.install
File metadata and controls
81 lines (70 loc) · 2 KB
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
<?php
/**
* @file
* Install functionality.
*/
/**
* Implements hook_install().
*/
function ding_language_install() {
// Enable detection of language from URL.
$negotiation = [
'locale-url' => [
'callbacks' => [
'language' => 'locale_language_from_url',
'switcher' => 'locale_language_switcher_url',
'url_rewrite' => 'locale_language_url_rewrite_url',
],
'file' => 'includes/locale.inc',
],
'language-default' => [
'callbacks' => [
'language' => 'language_from_default',
],
],
];
variable_del('language_negotiation_language');
variable_set('language_negotiation_language', $negotiation);
// Set custom path to language icons.
variable_set('languageicons_path', 'https://storage.easyting.dk/icons/*.png');
// Enable multilanguage support for content types.
$content_types = node_type_get_types();
foreach ($content_types as $content_type) {
variable_set('language_content_type_' . $content_type->type, 2);
}
if (!module_exists('i18n_taxonomy')) {
module_enable(array('i18n_taxonomy'));
}
// Enable localization for taxonomy vocabularies.
$vocabularies = taxonomy_get_vocabularies();
foreach ($vocabularies as $vocabulary) {
db_update('taxonomy_vocabulary')
->fields(array(
'i18n_mode' => 1,
))
->execute();
i18n_string_object_update('taxonomy_vocabulary', $vocabulary);
}
$string_formats = [
'ding_wysiwyg' => 'ding_wysiwyg',
'plain_text' => 'plain_text',
];
variable_set('i18n_string_allowed_formats', $string_formats);
variable_set('ding_language_random', rand());
}
/**
* Allow translation of WYSIWYG enabled fields.
*/
function ding_language_update_7001(&$sandbox) {
$string_formats = [
'ding_wysiwyg' => 'ding_wysiwyg',
'plain_text' => 'plain_text',
];
variable_set('i18n_string_allowed_formats', $string_formats);
}
/**
* Enable Block Internationalization module.
*/
function ding_language_update_7002() {
module_enable(['i18n_block']);
}