/** * Render a subview for this view * * All the styles and scripts of the subview will be added to the main view * * @param zibo\core\View $view the view to render * @return string The output of the view */ protected function renderView(View $view) { $renderedView = $view->render(true); if (!$view instanceof HtmlView) { return $renderedView; } $this->meta = Structure::merge($this->meta, $view->getMeta()); $this->styles = Structure::merge($this->styles, $view->getStyles()); $this->scripts = Structure::merge($this->scripts, $view->getJavascripts()); $this->inlineScripts = Structure::merge($this->inlineScripts, $view->getInlineJavascripts()); return $renderedView; }
/** * Process a smarty view, set the resource handler of this page and set the region name * @param zibo\core\View $widgetView view of the widget * @param int $widgetId id of the widget * @param string $regionName name of the region * @return null */ protected function processSmartyView(View $widgetView, $widgetId, $regionName) { if (!$widgetView instanceof SmartyView) { return; } $widgetView->setResourceHandler($this->resourceHandler); $widgetView->getEngine()->compile_id = $widgetId; $widgetView->set('_widgetId', $widgetId); $widgetView->set('_region', $regionName); $widgetView->set('_node', $this->node); $widgetSubviews = $widgetView->getSubviews(); foreach ($widgetSubviews as $widgetSubview) { $this->processSmartyView($widgetSubview, $widgetId, $regionName); } }