-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathextend.php
56 lines (47 loc) · 1.2 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
48
49
50
51
52
53
54
55
56
<?php
/*
* This file is part of Flarum.
*
* For detailed copyright and license information, please view the
* LICENSE file that was distributed with this source code.
*/
use Flarum\Extend;
use Flarum\Foundation\AbstractServiceProvider;
use Flarum\Foundation\Application;
use FoF\Upload\Contracts\Template;
use FoF\Upload\File;
use FoF\Upload\Helpers\Settings;
class MyTemplate implements Template
{
public function tag(): string
{
return 'ImgurTemplate';
}
public function name(): string
{
return 'Imgur Template';
}
public function description(): string
{
return 'Imgur Template';
}
public function preview(File $file): string
{
return '[img]https:' . $file->url . '[/img]';
}
}
class MyServiceProvider extends AbstractServiceProvider
{
public function register()
{
$this->app->make(Settings::class)->addRenderTemplate($this->app->make(MyTemplate::class));
}
}
return [
// Register extenders here to customize your forum!
new Extend\Compat(function (Application $app) {
$app->register(MyServiceProvider::class);
}),
(new Extend\Frontend('forum'))
->css(__DIR__ . '/less/forum.less')
];