-
Notifications
You must be signed in to change notification settings - Fork 2
/
extend.php
41 lines (30 loc) · 1.23 KB
/
extend.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
<?php
namespace katosdev\Signature;
use Flarum\Extend;
use Flarum\User\User;
use Flarum\Api\Serializer\UserSerializer;
use Flarum\User\Event\Saving as UserSaving;
return [
(new Extend\Frontend('forum'))
->js(__DIR__ . '/js/dist/forum.js')
->css(__DIR__ . '/less/forum.less')
->route('/u:username/signature', 'user.signature'),
(new Extend\Frontend('admin'))
->js(__DIR__ . '/js/dist/admin.js'),
new Extend\Locales(__DIR__ . '/locale'),
(new Extend\ApiSerializer(UserSerializer::class))
->attributes(Api\AddUserAttributes::class),
(new Extend\Event())
->listen(UserSaving::class, Listener\SaveSignatureToDatabase::class),
(new Extend\Settings())
->default('signature.maximum_char_limit', 500)
->default('signature.maximum_image_count', 2)
->default('signature.allow_inline_editing', false)
->serializeToForum('allowInlineEditing', 'signature.allow_inline_editing', 'boolval'),
(new Extend\Model(User::class))
->cast('signature', 'string'),
(new Extend\Policy())
->modelPolicy(User::class, Access\UserPolicy::class),
(new Extend\ServiceProvider())
->register(Provider\SignatureFormatterProvider::class),
];