From ef9ed7f4fa9474bb21b837512633236a2bab52c4 Mon Sep 17 00:00:00 2001 From: Charlie Date: Sat, 11 Aug 2018 00:45:11 -0700 Subject: [PATCH] Dispatch the Deserializing event in Admin Content (#1532) * Dispatch the Deserializing event * Apply fixes from StyleCI (#1) --- src/Admin/Content/AdminPayload.php | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/Admin/Content/AdminPayload.php b/src/Admin/Content/AdminPayload.php index af70617aa..59fdf45ab 100644 --- a/src/Admin/Content/AdminPayload.php +++ b/src/Admin/Content/AdminPayload.php @@ -15,7 +15,9 @@ use Flarum\Extension\ExtensionManager; use Flarum\Frontend\Content\ContentInterface; use Flarum\Frontend\HtmlDocument; use Flarum\Group\Permission; +use Flarum\Settings\Event\Deserializing; use Flarum\Settings\SettingsRepositoryInterface; +use Illuminate\Contracts\Events\Dispatcher; use Illuminate\Database\ConnectionInterface; use Psr\Http\Message\ServerRequestInterface as Request; @@ -40,17 +42,25 @@ class AdminPayload implements ContentInterface * @param SettingsRepositoryInterface $settings * @param ExtensionManager $extensions * @param ConnectionInterface $db + * @param Dispatcher $events */ - public function __construct(SettingsRepositoryInterface $settings, ExtensionManager $extensions, ConnectionInterface $db) + public function __construct(SettingsRepositoryInterface $settings, ExtensionManager $extensions, ConnectionInterface $db, Dispatcher $events) { $this->settings = $settings; $this->extensions = $extensions; $this->db = $db; + $this->events = $events; } public function populate(HtmlDocument $document, Request $request) { - $document->payload['settings'] = $this->settings->all(); + $settings = $this->settings->all(); + + $this->events->dispatch( + new Deserializing($settings) + ); + + $document->payload['settings'] = $settings; $document->payload['permissions'] = Permission::map(); $document->payload['extensions'] = $this->extensions->getExtensions()->toArray();