forked from robertweiss/ProcessTranslatePage
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProcessTranslatePage.config.php
78 lines (70 loc) · 2.47 KB
/
ProcessTranslatePage.config.php
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
<?php namespace ProcessWire;
$excludedTemplatesOptions = [];
if (wire('templates')) {
foreach (wire('templates') as $template) {
if ($template->flags && $template->flags === Template::flagSystem) {
continue;
}
$label = $template->label ? $template->label . ' (' . $template->name . ')' : $template->name;
$excludedTemplatesOptions[$template->name] = $label;
}
}
$excludedFieldsOptions = [];
if (wire('fields')) {
foreach (wire('fields') as $field) {
if ($field->flags && $field->flags === Field::flagSystem) {
continue;
}
$label = $field->label ? $field->label . ' (' . $field->name . ')' : $field->name;
$excludedFieldsOptions[$field->name] = $label;
}
}
$excludedLanguagesOptions = [];
if (wire('languages')) {
foreach (wire('languages') as $language) {
if ($language->name === 'default') {
continue;
}
$excludedLanguagesOptions[$language->name] = $language->get('title|name');
}
}
$config = [
'overwriteExistingTranslation' => [
'type' => 'checkbox',
'label' => __('Overwrite existing translations'),
'description' => __('If checked, all existing target language fields are overwritten on save. Otherwise, only empty fields are filled.'),
'value' => false,
'columnWidth' => 50
],
'showSingleTargetLanguageButtons' => [
'type' => 'checkbox',
'label' => __('Show single target language buttons'),
'description' => __('If checked, the save dropdown will add one button for each allowed target language instead of one button for all languages combined.'),
'value' => false,
'columnWidth' => 50
],
'excludedTemplates' => [
'type' => 'asmSelect',
'label' => __('Excluded Templates'),
'description' => __('Pages with these templates will not display the save + translate option in the save dropdown'),
'options' => $excludedTemplatesOptions,
'value' => [],
'columnWidth' => 33
],
'excludedFields' => [
'type' => 'asmSelect',
'label' => __('Excluded Fields'),
'description' => __('Fields that will be ignored when translating'),
'options' => $excludedFieldsOptions,
'value' => [],
'columnWidth' => 33
],
'excludedLanguages' => [
'type' => 'asmSelect',
'label' => __('Excluded Languages'),
'description' => __('Target languages that will be ignored when translating'),
'options' => $excludedLanguagesOptions,
'value' => [],
'columnWidth' => 34
],
];