1
|
<?php
|
2
|
/**
|
3
|
* @file
|
4
|
* Variable information
|
5
|
*/
|
6
|
|
7
|
/**
|
8
|
* Implements hook_variable_group_info().
|
9
|
*/
|
10
|
function i18n_node_variable_group_info() {
|
11
|
$groups['i18n_node'] = array(
|
12
|
'title' => t('Multilingual node options'),
|
13
|
'description' => t('Extended node options for multilingual sites.'),
|
14
|
'access' => 'administer site configuration',
|
15
|
'path' => 'admin/config/regional/i18n/node',
|
16
|
);
|
17
|
return $groups;
|
18
|
}
|
19
|
|
20
|
/**
|
21
|
* Implements hook_variable_info().
|
22
|
*/
|
23
|
function i18n_node_variable_info($options = array()) {
|
24
|
$variables['i18n_hide_translation_links'] = array(
|
25
|
'type' => 'boolean',
|
26
|
'title' => t('Hide content translation links', array(), $options),
|
27
|
'description' => t('Hide the links to translations in content body and teasers. If you choose this option, switching language will only be available from the language switcher block.', array(), $options),
|
28
|
'default' => 0,
|
29
|
'group' => 'i18n_node',
|
30
|
);
|
31
|
$variables['i18n_node_default_language_none'] = array(
|
32
|
'title' => t('Default language for content types with Multilingual support disabled.', array(), $options),
|
33
|
'description' => t('Determines which language will be set for newly created content of types that don\'t have Multilingual support enabled.', array(), $options),
|
34
|
'type' => 'select',
|
35
|
'options' => array(
|
36
|
0 => t('The site\'s default language (Default behaviour).', array(), $options),
|
37
|
1 => t('Language neutral (Recommended).', array(), $options)
|
38
|
),
|
39
|
'default' => 0,
|
40
|
'group' => 'i18n_node',
|
41
|
);
|
42
|
$variables['i18n_node_options_[node_type]'] = array(
|
43
|
'type' => 'multiple',
|
44
|
'title' => t('Extended language options', array(), $options),
|
45
|
'repeat' => array(
|
46
|
'type' => 'options',
|
47
|
'options' => array(
|
48
|
// Note: this was previously used only to mark new, translatable nodes
|
49
|
// with the current language of the user. Now, this setting is extended
|
50
|
// to allow a specific language to be chosen (defaulting to the current
|
51
|
// language). This was done for backwards compatibility reasons.
|
52
|
'current' => t('Set custom language as default for new content.', array(), $options),
|
53
|
'required' => t('Require language (Do not allow Language Neutral).', array(), $options),
|
54
|
'lock' => t('Lock language (Cannot be changed).', array(), $options),
|
55
|
),
|
56
|
),
|
57
|
'group' => 'i18n',
|
58
|
);
|
59
|
// This field will only be displayed if "current" is checked above.
|
60
|
$variables['i18n_node_default_language_for_[node_type]'] = array(
|
61
|
'type' => 'multiple',
|
62
|
'title' => t('Custom default language', array(), $options),
|
63
|
'repeat' => array(
|
64
|
'type' => 'select',
|
65
|
'options' => array_merge(array(
|
66
|
'-- current --' => t('Current language')
|
67
|
), locale_language_list('name')),
|
68
|
'default' => '-- current --',
|
69
|
),
|
70
|
'group' => 'i18n',
|
71
|
);
|
72
|
$variables['i18n_node_extended_[node_type]'] = array(
|
73
|
'type' => 'multiple',
|
74
|
'title' => t('Extended language support'),
|
75
|
'repeat' => array(
|
76
|
'type' => 'select',
|
77
|
'options callback' => 'i18n_node_variable_extended_options',
|
78
|
'default' => I18N_LANGUAGE_ENABLED,
|
79
|
),
|
80
|
'description' => t('If enabled, all defined languages will be allowed for this content type in addition to only enabled ones. This is useful to have more languages for content than for the interface.', array(), $options),
|
81
|
'group' => 'i18n',
|
82
|
);
|
83
|
|
84
|
return $variables;
|
85
|
}
|
86
|
|
87
|
/**
|
88
|
* Options callback for i18n_node_extended_
|
89
|
*/
|
90
|
function i18n_node_variable_extended_options($variable, $options) {
|
91
|
return array(
|
92
|
I18N_LANGUAGE_ENABLED => t('Normal - All enabled languages will be allowed.', array(), $options),
|
93
|
I18N_LANGUAGE_EXTENDED => t('Extended - All defined languages will be allowed.', array(), $options),
|
94
|
I18N_LANGUAGE_EXTENDED | I18N_LANGUAGE_HIDDEN => t('Extended, but not displayed - All defined languages will be allowed for input, but not displayed in links.', array(), $options),
|
95
|
);
|
96
|
}
|