forked from Daandelange/kirby3-TranslatedLayout
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
executable file
·78 lines (70 loc) · 3.31 KB
/
index.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
use \Kirby\Form\Field\LayoutField; // maybe not needed ?
require_once(__DIR__ . '/src/classes/TranslatedLayoutField.php');
require_once(__DIR__ . '/src/classes/TranslatedBlocksField.php');
Kirby::plugin('daandelange/translatedlayout', [
'fields' => [
// Undocumented, but identical to kirby's blocks and layout registering
// Strings are checked against classes then instanciated.
// See: https://github.com/getkirby/kirby/issues/3961
'translatedlayout' => 'TranslatedLayoutField',
'translatedblocks' => 'TranslatedBlocksField',
],
'blueprints' => [
// Todo: Possible issue = when these blocks are not registered in the user blueprint, they get added. NVM they are just defaults.
'fields/translatedlayoutwithfieldsetsbis' => __DIR__ . '/src/blueprints/fields/translatedlayoutwithfieldsets.yml',
'fields/translatedlayoutwithfieldsets' => function ($kirby) { // Todo: rename this to translatedlayoutwithfieldsettranslations
// Put all static definitions in an yml file so it's easier to copy/paste/write.
// From Kirby/Cms/Blueprint.php in function find()
// Query existing blocks
$blockBlueprints = $kirby->blueprints('blocks');
return array_merge(
// Load static properties from file
Data::read( __DIR__ . '/src/blueprints/fields/translatedlayoutwithfieldsets.yml' ),
// Dynamically inject non-default blocks depending on installed addons
// Todo: add more translation settings for community blocks
//
(in_array('woo/localvideo', $blockBlueprints) ? [
'translate' => false,
'tabs' => [
'source' => [
'fields' => [
'vidfile' => [
'translate' => false,
],
'vidposter' => [
'translate' => false,
],
],
],
'settings' => [
'fields' => [
'class' => [
'translate' => false,
],
'controls' => [
'translate' => false,
],
'mute' => [
'translate' => false,
],
'autoplay' => [
'translate' => false,
],
'loop' => [
'translate' => false,
],
'playsinline' => [
'translate' => false,
],
'preload' => [
'translate' => false,
],
],
],
]
] : [])
);
}
],
]);