/** * Renders a layout. Returns output from _render(). Returns false on * error. Several variables are created for use in layout * @param string $content Content to render in a view, wrapped by the * surrounding layout * @param string|null $layout Layout name * @return mixed Rendered output, or false on error * @see http://api.cakephp.org/3.3/class-Cake.View.View.html#_renderLayout * @uses MeCms\View\View\BaseView::renderLayout() * @uses MeTools\Core\Plugin::path() * @uses MeTools\View\Helper\HtmlHelper::meta() * @uses MeTools\View\Helper\LibraryHelper::analytics() * @uses MeTools\View\Helper\LibraryHelper::shareaholic() * @uses _addFacebookTags() * @uses $userbar */ public function renderLayout($content, $layout = null) { $path = 'src' . DS . 'Template' . DS . 'Layout' . DS; if ($this->layoutPath()) { $path .= $this->layoutPath() . DS; } $path .= $layout . '.ctp'; //Uses the APP layout, if exists if (is_readable(ROOT . DS . $path)) { $this->plugin = false; } //Sets the theme and uses the theme layout, if exists if (config('default.theme') && !$this->theme()) { $this->theme(config('default.theme')); if (is_readable(Plugin::path($this->theme()) . $path)) { $this->plugin = $this->theme(); } } //Adds the "theme color" (the toolbar color for some mobile browser) if (config('default.toolbar_color')) { $this->Html->meta('theme-color', config('default.toolbar_color')); } //Adds the meta tag for RSS posts if (config('default.rss_meta')) { $this->Html->meta(__d('me_cms', 'Latest posts'), '/posts/rss', ['type' => 'rss']); } //Adds Google Analytics if (config('default.analytics')) { echo $this->Library->analytics(config('default.analytics')); } //Adds Shareaholic if (config('shareaholic.site_id')) { echo $this->Library->shareaholic(config('shareaholic.site_id')); } //Adds Facebook's tags $this->_addFacebookTags(); //Assign the userbar $this->assign('userbar', implode(PHP_EOL, array_map(function ($element) { return $this->Html->li($element); }, $this->userbar))); return parent::renderLayout($content, $layout); }
/** * Renders a layout. Returns output from _render(). Returns false on error. * Several variables are created for use in layout * @param string $content Content to render in a view, wrapped by the * surrounding layout * @param string|null $layout Layout name * @return mixed Rendered output, or false on error * @see http://api.cakephp.org/3.3/class-Cake.View.View.html#_renderLayout */ public function renderLayout($content, $layout = null) { $layout = 'MeCms.admin'; return parent::renderLayout($content, $layout); }