mirror of
https://github.com/flarum/framework.git
synced 2024-11-24 21:43:10 +08:00
Move events to Flarum\Settings\Event namespace
This commit is contained in:
parent
564ea8ff73
commit
551e76f296
|
@ -13,7 +13,7 @@ namespace Flarum\Admin;
|
|||
|
||||
use Flarum\Event\ExtensionWasDisabled;
|
||||
use Flarum\Event\ExtensionWasEnabled;
|
||||
use Flarum\Event\SettingWasSet;
|
||||
use Flarum\Settings\Event\Saved;
|
||||
use Flarum\Foundation\AbstractServiceProvider;
|
||||
use Flarum\Http\Handler\RouteHandlerFactory;
|
||||
use Flarum\Http\RouteCollection;
|
||||
|
@ -63,7 +63,7 @@ class AdminServiceProvider extends AbstractServiceProvider
|
|||
|
||||
protected function flushWebAppAssetsWhenThemeChanged()
|
||||
{
|
||||
$this->app->make('events')->listen(SettingWasSet::class, function (SettingWasSet $event) {
|
||||
$this->app->make('events')->listen(Saved::class, function (Saved $event) {
|
||||
if (preg_match('/^theme_|^custom_less$/i', $event->key)) {
|
||||
$this->getWebAppAssets()->flushCss();
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ namespace Flarum\Admin\Controller;
|
|||
|
||||
use Flarum\Admin\Frontend;
|
||||
use Flarum\Core\Permission;
|
||||
use Flarum\Event\PrepareUnserializedSettings;
|
||||
use Flarum\Settings\Event\Deserializing;
|
||||
use Flarum\Extension\ExtensionManager;
|
||||
use Flarum\Frontend\AbstractFrontendController;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
|
@ -56,7 +56,7 @@ class FrontendController extends AbstractFrontendController
|
|||
$settings = $this->settings->all();
|
||||
|
||||
$this->events->fire(
|
||||
new PrepareUnserializedSettings($settings)
|
||||
new Deserializing($settings)
|
||||
);
|
||||
|
||||
$view->setVariable('settings', $settings);
|
||||
|
|
|
@ -12,8 +12,8 @@
|
|||
namespace Flarum\Api\Controller;
|
||||
|
||||
use Flarum\Core\Access\AssertPermissionTrait;
|
||||
use Flarum\Event\PrepareSerializedSetting;
|
||||
use Flarum\Event\SettingWasSet;
|
||||
use Flarum\Settings\Event\Serializing;
|
||||
use Flarum\Settings\Event\Saved;
|
||||
use Flarum\Http\Controller\ControllerInterface;
|
||||
use Flarum\Settings\SettingsRepositoryInterface;
|
||||
use Illuminate\Contracts\Events\Dispatcher;
|
||||
|
@ -53,11 +53,11 @@ class SetSettingsController implements ControllerInterface
|
|||
$settings = $request->getParsedBody();
|
||||
|
||||
foreach ($settings as $k => $v) {
|
||||
$this->dispatcher->fire(new PrepareSerializedSetting($k, $v));
|
||||
$this->dispatcher->fire(new Serializing($k, $v));
|
||||
|
||||
$this->settings->set($k, $v);
|
||||
|
||||
$this->dispatcher->fire(new SettingWasSet($k, $v));
|
||||
$this->dispatcher->fire(new Saved($k, $v));
|
||||
}
|
||||
|
||||
return new EmptyResponse(204);
|
||||
|
|
|
@ -14,7 +14,7 @@ namespace Flarum\Forum;
|
|||
use Flarum\Event\ConfigureForumRoutes;
|
||||
use Flarum\Event\ExtensionWasDisabled;
|
||||
use Flarum\Event\ExtensionWasEnabled;
|
||||
use Flarum\Event\SettingWasSet;
|
||||
use Flarum\Settings\Event\Saved;
|
||||
use Flarum\Foundation\AbstractServiceProvider;
|
||||
use Flarum\Http\Handler\RouteHandlerFactory;
|
||||
use Flarum\Http\RouteCollection;
|
||||
|
@ -82,7 +82,7 @@ class ForumServiceProvider extends AbstractServiceProvider
|
|||
|
||||
protected function flushWebAppAssetsWhenThemeChanged()
|
||||
{
|
||||
$this->app->make('events')->listen(SettingWasSet::class, function (SettingWasSet $event) {
|
||||
$this->app->make('events')->listen(Saved::class, function (Saved $event) {
|
||||
if (preg_match('/^theme_|^custom_less$/i', $event->key)) {
|
||||
$this->getWebAppAssets()->flushCss();
|
||||
}
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Event;
|
||||
namespace Flarum\Settings\Event;
|
||||
|
||||
/**
|
||||
* Prepare settings for display in the client.
|
||||
|
@ -17,7 +17,7 @@ namespace Flarum\Event;
|
|||
* This event is fired when settings have been retrieved from the database and
|
||||
* are being unserialized for display in the client.
|
||||
*/
|
||||
class PrepareUnserializedSettings
|
||||
class Deserializing
|
||||
{
|
||||
/**
|
||||
* The settings array to be unserialized.
|
|
@ -9,9 +9,9 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Event;
|
||||
namespace Flarum\Settings\Event;
|
||||
|
||||
class SettingWasSet
|
||||
class Saved
|
||||
{
|
||||
/**
|
||||
* The setting key that was set.
|
|
@ -9,9 +9,9 @@
|
|||
* file that was distributed with this source code.
|
||||
*/
|
||||
|
||||
namespace Flarum\Event;
|
||||
namespace Flarum\Settings\Event;
|
||||
|
||||
class PrepareSerializedSetting
|
||||
class Serializing
|
||||
{
|
||||
/**
|
||||
* The settings key being saved.
|
Loading…
Reference in New Issue
Block a user