From ba41c5313a1d928e78c8e18f17822b08096398a1 Mon Sep 17 00:00:00 2001 From: Toby Zerner Date: Fri, 31 Jul 2015 20:13:13 +0930 Subject: [PATCH] Allow for the addition of admin assets I think the `BuildClientView` event should ultimately be split into two separate events for the forum/admin clients, but this is fine for now. --- src/Events/BuildClientView.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/Events/BuildClientView.php b/src/Events/BuildClientView.php index 2528f91a5..e637ee370 100644 --- a/src/Events/BuildClientView.php +++ b/src/Events/BuildClientView.php @@ -3,6 +3,7 @@ use Flarum\Support\ClientAction; use Flarum\Support\ClientView; use Flarum\Forum\Actions\ClientAction as ForumClientAction; +use Flarum\Admin\Actions\ClientAction as AdminClientAction; class BuildClientView { @@ -54,4 +55,19 @@ class BuildClientView $this->keys[] = $key; } } - }} + } + + public function adminAssets($files) + { + if ($this->action instanceof AdminClientAction) { + $this->view->getAssets()->addFiles((array) $files); + } + } + + public function adminBootstrapper($bootstrapper) + { + if ($this->action instanceof AdminClientAction) { + $this->view->addBootstrapper($bootstrapper); + } + } +}