forked from FriendsOfFlarum/best-answer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathextend.php
More file actions
63 lines (52 loc) · 2.16 KB
/
Copy pathextend.php
File metadata and controls
63 lines (52 loc) · 2.16 KB
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
59
60
61
62
63
<?php
/*
* This file is part of fof/best-answer.
*
* Copyright (c) 2019 FriendsOfFlarum.
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace FoF\BestAnswer;
use Flarum\Api\Serializer\BasicDiscussionSerializer;
use Flarum\Console\Event\Configuring;
use Flarum\Discussion\Event\Saving;
use Flarum\Event\ConfigureNotificationTypes;
use Flarum\Extend;
use Flarum\Foundation\Application;
use FoF\BestAnswer\Console\NotifyCommand;
use FoF\BestAnswer\Notification\AwardedBestAnswerBlueprint;
use FoF\BestAnswer\Notification\SelectBestAnswerBlueprint;
use FoF\BestAnswer\Provider\ConsoleProvider;
use FoF\Components\Extend\AddFofComponents;
use FoF\Console\Extend\EnableConsole;
use Illuminate\Console\Scheduling\Schedule;
use Illuminate\Contracts\View\Factory;
use Illuminate\Events\Dispatcher;
return [
new AddFofComponents(),
(new Extend\Frontend('forum'))
->js(__DIR__.'/js/dist/forum.js')
->css(__DIR__.'/resources/less/forum.less'),
(new Extend\Frontend('admin'))
->js(__DIR__.'/js/dist/admin.js')
->css(__DIR__.'/resources/less/admin.less'),
new Extend\Locales(__DIR__.'/resources/locale'),
new EnableConsole(),
new DefaultSettings(),
new Extend\Compat(function (Application $app, Dispatcher $events, Factory $views) {
$events->listen(Configuring::class, function (Configuring $event) {
if ($event->app->bound(Schedule::class)) {
$event->addCommand(NotifyCommand::class);
}
});
$events->listen(ConfigureNotificationTypes::class, function (ConfigureNotificationTypes $event) {
$event->add(SelectBestAnswerBlueprint::class, BasicDiscussionSerializer::class, ['alert', 'email']);
$event->add(AwardedBestAnswerBlueprint::class, BasicDiscussionSerializer::class, ['alert']);
});
$events->subscribe(Listeners\AddApiAttributes::class);
$events->listen(Saving::class, Listeners\SelectBestAnswer::class);
$views->addNamespace('fof-best-answer', __DIR__.'/resources/views');
$app->register(ConsoleProvider::class);
}),
];