-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.php
58 lines (51 loc) · 1.79 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
<?php
use Kirby\Content\Field;
use trych\FieldComposer\FieldMethods;
use trych\FieldComposer\FieldComposer;
@include_once __DIR__ . '/vendor/autoload.php';
Kirby::plugin(
name: 'trych/field-composer',
extends: [
'fieldMethods' => [
'merge' => [FieldMethods::class, 'merge'],
'format' => [FieldMethods::class, 'format'],
'prefix' => [FieldMethods::class, 'prefix'],
'suffix' => [FieldMethods::class, 'suffix'],
'when' => [FieldMethods::class, 'when'],
'whenAny' => [FieldMethods::class, 'whenAny'],
'notWhen' => [FieldMethods::class, 'notWhen'],
'notWhenAny' => [FieldMethods::class, 'notWhenAny'],
'whenAll' => [FieldMethods::class, 'whenAll'],
'whenNone' => [FieldMethods::class, 'whenNone'],
'match' => [FieldMethods::class, 'match'],
'wrap' => [FieldMethods::class, 'wrap'],
'tag' => [FieldMethods::class, 'tag'],
'list' => [FieldMethods::class, 'list'],
'count' => [FieldMethods::class, 'count'],
'str' => [FieldMethods::class, 'str'],
'dump' => [FieldMethods::class, 'dump'],
'log' => [FieldMethods::class, 'log'],
],
'options' => [
'mergeSeparator' => ', ',
'affixSeparator' => '',
'listJoinSeparator' => ', ',
'listConjunction' => null
],
'hooks' => [
'system.loadPlugins:after' => function () {
// register field helper functions
if (Helpers::hasOverride('field') === false && !function_exists('field')) {
function field(...$args): Field {
return FieldComposer::compose(...$args);
}
}
if (Helpers::hasOverride('f') === false && !function_exists('f')) {
function f(...$args): Field {
return FieldComposer::compose(...$args);
}
}
}
]
]
);