-
-
Notifications
You must be signed in to change notification settings - Fork 8
/
extend.php
32 lines (27 loc) · 1.03 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
<?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\Frontend\Document;
use Psr\Http\Message\ServerRequestInterface as Request;
return [
(new Extend\Frontend('forum'))
->route(
'/embed/{id:\d+(?:-[^/]*)?}[/{near:[^/]*}]',
'embed.discussion',
function (Document $document, Request $request) {
// Add the discussion content to the document so that the
// payload will be included on the page and the JS app will be
// able to render the discussion immediately.
resolve(Flarum\Forum\Content\Discussion::class)($document, $request);
resolve(Flarum\Frontend\Content\Assets::class)->forFrontend('embed')($document, $request);
}
),
(new Extend\Frontend('embed'))
->js(__DIR__.'/js/dist/forum.js')
->css(__DIR__.'/less/forum.less')
];