1
0
mirror of https://github.com/flarum/core.git synced 2025-10-10 22:44:25 +02:00

Rework extension bootstrapping

System JS modules don't execute when they're registered, so we need to
import them explicitly. While we're at it, we may as well make the
locale bootstrapper a module too.
This commit is contained in:
Toby Zerner
2015-07-20 18:08:28 +09:30
parent 19fe138770
commit 6b7cf1b6bf
12 changed files with 130 additions and 59 deletions

View File

@@ -2,23 +2,24 @@
use Flarum\Support\ClientAction;
use Flarum\Support\ClientView;
use Flarum\Forum\Actions\ClientAction as ForumClientAction;
class BuildClientView
{
/**
* @var ClientAction
*/
protected $action;
public $action;
/**
* @var ClientView
*/
protected $view;
public $view;
/**
* @var array
*/
protected $keys;
public $keys;
/**
* @param ClientAction $action
@@ -31,4 +32,26 @@ class BuildClientView
$this->view = $view;
$this->keys = &$keys;
}
}
public function forumAssets($files)
{
if ($this->action instanceof ForumClientAction) {
$this->view->getAssets()->addFiles((array) $files);
}
}
public function forumBootstrapper($bootstrapper)
{
if ($this->action instanceof ForumClientAction) {
$this->view->addBootstrapper($bootstrapper);
}
}
public function forumTranslations(array $keys)
{
if ($this->action instanceof ForumClientAction) {
foreach ($keys as $key) {
$this->keys[] = $key;
}
}
}}