/** * Set up the locale compiler for the given locale. * * @param string $locale * @return LocaleJsCompiler */ protected function getLocaleCompiler($locale) { $compiler = new LocaleJsCompiler($this->getAssetDirectory(), "{$this->clientName}-{$locale}.js"); foreach ($this->locales->getJsFiles($locale) as $file) { $compiler->addFile($file); } return $compiler; }
/** * Get the string contents of the view. * * @return string */ public function render() { $view = app('view')->file(__DIR__ . '/../../../views/app.blade.php'); $forum = $this->getForumDocument(); $data = $this->getDataFromDocument($forum); if ($this->actor->exists) { $user = $this->getUserDocument(); $data = array_merge($data, $this->getDataFromDocument($user)); } $view->app = ['preload' => ['data' => $data, 'session' => $this->getSession(), 'document' => $this->document]] + $this->variables; $view->bootstrappers = $this->bootstrappers; $noJs = array_get($this->request->getQueryParams(), 'nojs'); $view->title = ($this->title ? $this->title . ' - ' : '') . $forum->data->attributes->title; $view->forum = $forum->data; $view->layout = app('view')->file($this->layout, ['forum' => $forum->data, 'content' => app('view')->file(__DIR__ . '/../../../views/content.blade.php', ['content' => $this->content, 'noJs' => $noJs, 'forum' => $forum->data])]); $view->noJs = $noJs; $view->styles = [$this->assets->getCssFile()]; $view->scripts = [$this->assets->getJsFile()]; if ($this->localeJs) { $view->scripts[] = $this->localeJs->getFile(); } $view->head = implode("\n", $this->headStrings); $view->foot = implode("\n", $this->footStrings); return $view->render(); }