/** * 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(); }
/** * Add any configured JS/LESS customizations to the asset manager. * * @param AssetManager $assets */ protected function addCustomizations(AssetManager $assets) { $assets->addLess(function () { $less = ''; foreach ($this->getLessVariables() as $name => $value) { $less .= "@{$name}: {$value};"; } $less .= $this->settings->get('custom_less'); return $less; }); }