mirror of
https://github.com/flarum/core.git
synced 2025-07-30 21:20:24 +02:00
Update for beta 8
This commit is contained in:
41
extensions/embed/extend.php
Normal file
41
extensions/embed/extend.php
Normal file
@@ -0,0 +1,41 @@
|
||||
<?php
|
||||
|
||||
/*
|
||||
* This file is part of Flarum.
|
||||
*
|
||||
* (c) Toby Zerner <toby.zerner@gmail.com>
|
||||
*
|
||||
* For the full copyright and license information, please view the LICENSE
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Flarum\Extend;
|
||||
use Flarum\Frontend\Document;
|
||||
use Illuminate\Contracts\View\Factory;
|
||||
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.
|
||||
app(Flarum\Forum\Content\Discussion::class)($document, $request);
|
||||
|
||||
app(Flarum\Frontend\Content\Assets::class)->forFrontend('embed')($document, $request);
|
||||
}
|
||||
),
|
||||
|
||||
(new Extend\Frontend('embed'))
|
||||
->js(__DIR__.'/js/dist/forum.js')
|
||||
->css(__DIR__.'/less/forum.less')
|
||||
->css(base_path().'/vendor/flarum/core/less/common/variables.less')
|
||||
->css(base_path().'/vendor/flarum/core/less/common/mixins.less'),
|
||||
|
||||
function (Factory $view) {
|
||||
$view->addNamespace('flarum-embed', __DIR__.'/views');
|
||||
}
|
||||
];
|
Reference in New Issue
Block a user