-
-
Notifications
You must be signed in to change notification settings - Fork 10
/
extend.php
executable file
·47 lines (38 loc) · 1.58 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
42
43
44
45
46
47
<?php
/*
* This file is part of fof/links.
*
* Copyright (c) FriendsOfFlarum.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
use Flarum\Api\Controller\ShowForumController;
use Flarum\Api\Serializer\ForumSerializer;
use Flarum\Extend;
use FoF\Links\Api\Controller;
use FoF\Links\Api\Serializer\LinkSerializer;
use FoF\Links\LoadForumLinksRelationship;
return [
new Extend\Locales(__DIR__.'/locale'),
(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')
->css(__DIR__.'/less/admin.less'),
(new Extend\Routes('api'))
->post('/links', 'links.create', Controller\CreateLinkController::class)
->post('/links/order', 'links.order', Controller\OrderLinksController::class)
->patch('/links/{id}', 'links.update', Controller\UpdateLinkController::class)
->delete('/links/{id}', 'links.delete', Controller\DeleteLinkController::class),
(new Extend\ApiSerializer(ForumSerializer::class))
->hasMany('links', LinkSerializer::class),
(new Extend\ApiController(ShowForumController::class))
->addInclude(['links', 'links.parent'])
->prepareDataForSerialization(LoadForumLinksRelationship::class),
(new Extend\Settings())
->registerLessConfigVar('fof-links-show-only-icons-on-mobile', 'fof-links.show_icons_only_on_mobile', function ($value) {
return $value ? 'true' : 'false';
}),
];