1
0
mirror of https://github.com/flarum/core.git synced 2025-10-10 14:34:30 +02:00
Files
php-flarum/src/Events/BuildClientView.php
Toby Zerner 6b7cf1b6bf 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.
2015-07-20 18:08:28 +09:30

58 lines
1.2 KiB
PHP

<?php namespace Flarum\Events;
use Flarum\Support\ClientAction;
use Flarum\Support\ClientView;
use Flarum\Forum\Actions\ClientAction as ForumClientAction;
class BuildClientView
{
/**
* @var ClientAction
*/
public $action;
/**
* @var ClientView
*/
public $view;
/**
* @var array
*/
public $keys;
/**
* @param ClientAction $action
* @param ClientView $view
* @param array $keys
*/
public function __construct($action, $view, &$keys)
{
$this->action = $action;
$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;
}
}
}}