-
Notifications
You must be signed in to change notification settings - Fork 2
/
extend.php
executable file
·33 lines (26 loc) · 1.73 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
<?php
use Flarum\Extend;
use Flarum\Api\Serializer\ForumSerializer;
use Ziven\MoneyLeaderboard\Controllers\MoneyLeaderboardController;
use Ziven\MoneyLeaderboard\Controllers\ListMoneyLeaderboardController;
$extend = [
(new Extend\Frontend('admin'))->js(__DIR__.'/js/dist/admin.js'),
(new Extend\Frontend('forum'))->js(__DIR__ . '/js/dist/forum.js')->css(__DIR__.'/less/forum.less')
->route('/moneyLeaderboard', 'moneyLeaderboard.index', MoneyLeaderboardController::class),
(new Extend\Locales(__DIR__ . '/locale')),
(new Extend\ApiSerializer(ForumSerializer::class))
->attribute('allowViewLeaderbaord', function (ForumSerializer $serializer) {
return $serializer->getActor()->hasPermission("moneyLeaderboard.allowViewLeaderbaord");
}),
(new Extend\Routes('api'))
->get('/moneyLeaderboard', 'moneyLeaderboard.get', ListMoneyLeaderboardController::class),
(new Extend\Settings())
->serializeToForum('moneyLeaderBoardIcon', 'ziven-money-leaderboard.moneyLeaderBoardIcon')
->serializeToForum('moneyLeaderBoardEntryPosition', 'ziven-money-leaderboard.moneyLeaderBoardEntryPosition')
->serializeToForum('moneyLeaderBoardAdditionalInfo', 'ziven-money-leaderboard.moneyLeaderBoardAdditionalInfo')
->serializeToForum('moneyLeaderBoardHideMoneyText', 'ziven-money-leaderboard.moneyLeaderBoardHideMoneyText')
->serializeToForum('leaderboardMaxLoadCount', 'ziven-money-leaderboard.leaderboardMaxLoadCount', 'intval')
->serializeToForum('leaderboardInitLoadCount', 'ziven-money-leaderboard.leaderboardInitLoadCount', 'intval')
->serializeToForum('leaderboardLoadMoreCount', 'ziven-money-leaderboard.leaderboardLoadMoreCount', 'intval'),
];
return $extend;