mirror of
https://github.com/flarum/core.git
synced 2025-08-06 16:36:47 +02:00
Adapt new bootstrap format, use Asset extender
This commit is contained in:
@@ -9,15 +9,23 @@
|
||||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
use Flarum\Extend;
|
||||
use Flarum\Suspend\Access;
|
||||
use Flarum\Suspend\Listener;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
return function (Dispatcher $events) {
|
||||
$events->subscribe(Listener\AddClientAssets::class);
|
||||
$events->subscribe(Listener\AddUserSuspendAttributes::class);
|
||||
$events->subscribe(Listener\RevokeAccessFromSuspendedUsers::class);
|
||||
$events->subscribe(Listener\SaveSuspensionToDatabase::class);
|
||||
return [
|
||||
(new Extend\Assets('forum'))
|
||||
->defaultAssets(__DIR__)
|
||||
->bootstrapper('flarum/suspend/main'),
|
||||
(new Extend\Assets('admin'))
|
||||
->defaultAssets(__DIR__)
|
||||
->bootstrapper('flarum/suspend/main'),
|
||||
function (Dispatcher $events) {
|
||||
$events->subscribe(Listener\AddUserSuspendAttributes::class);
|
||||
$events->subscribe(Listener\RevokeAccessFromSuspendedUsers::class);
|
||||
$events->subscribe(Listener\SaveSuspensionToDatabase::class);
|
||||
|
||||
$events->subscribe(Access\UserPolicy::class);
|
||||
};
|
||||
$events->subscribe(Access\UserPolicy::class);
|
||||
}
|
||||
];
|
||||
|
@@ -1,45 +0,0 @@
|
||||
<?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.
|
||||
*/
|
||||
|
||||
namespace Flarum\Suspend\Listener;
|
||||
|
||||
use Flarum\Frontend\Event\Rendering;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
||||
class AddClientAssets
|
||||
{
|
||||
/**
|
||||
* @param Dispatcher $events
|
||||
*/
|
||||
public function subscribe(Dispatcher $events)
|
||||
{
|
||||
$events->listen(Rendering::class, [$this, 'addAssets']);
|
||||
}
|
||||
|
||||
public function addAssets(Rendering $event)
|
||||
{
|
||||
if ($event->isForum()) {
|
||||
$event->addAssets([
|
||||
__DIR__.'/../../js/forum/dist/extension.js',
|
||||
__DIR__.'/../../less/forum/extension.less'
|
||||
]);
|
||||
$event->addBootstrapper('flarum/suspend/main');
|
||||
}
|
||||
|
||||
if ($event->isAdmin()) {
|
||||
$event->addAssets([
|
||||
__DIR__.'/../../js/admin/dist/extension.js',
|
||||
__DIR__.'/../../less/admin/extension.less'
|
||||
]);
|
||||
$event->addBootstrapper('flarum/suspend/main');
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user