-
Notifications
You must be signed in to change notification settings - Fork 12
/
extend.php
38 lines (29 loc) · 1.14 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
<?php
namespace AntoineFr\Online;
use AntoineFr\Online\Api\Serializer\OnlineSerializer;
use Flarum\Extend;
use Flarum\Api\Controller\ShowForumController;
use Flarum\Api\Serializer\ForumSerializer;
use Flarum\Locale\Translator;
return [
(new Extend\Frontend('forum'))
->js(__DIR__ . '/js/dist/forum.js')
->css(__DIR__ . '/less/forum.less'),
(new Extend\Frontend('admin'))
->js(__DIR__ . '/js/dist/admin.js'),
new Extend\Locales(__DIR__ . '/locale'),
(new Extend\Settings())
->serializeToForum('antoinefr-online.titleoflist', 'antoinefr-online.titleoflist', function ($attribute) {
if (empty($attribute)) {
return resolve(Translator::class)->get('antoinefr-online.forum.title');
}
return $attribute;
}),
(new Extend\ApiSerializer(ForumSerializer::class))
->hasMany('online', OnlineSerializer::class)
->hasOne('onlineMore', OnlineSerializer::class),
(new Extend\ApiController(ShowForumController::class))
->addInclude('online')
->addInclude('onlineMore')
->prepareDataForSerialization(LoadOnline::class)
];