/** * Method to render the view * * @return string The rendered view * * @since 1.0 * @throws \RuntimeException */ public function render() { $this->setData(['items' => $this->model->getItems(), 'package' => (new Helper())->getPackageDisplayName($this->model->getState()->get('package.name'))]); return parent::render(); }
/** * Set the body for error conditions * * @param \Exception $exception The Exception object * * @return void * * @since 1.0 */ private function setErrorOutput(\Exception $exception) { switch (strtolower($this->input->getWord('format', 'html'))) { case 'json': $data = ['code' => $exception->getCode(), 'message' => $exception->getMessage(), 'error' => true]; $body = json_encode($data); break; case 'html': default: // Need the default controller in order to fetch the renderer $controller = (new DefaultController($this->input, $this))->setContainer($this->getContainer()); // Build a default view object and render with the exception layout $controller->initializeRenderer(); $view = new DefaultHtmlView(new DefaultModel($this->getContainer()->get('db')), $this->getContainer()->get('renderer')); $body = $view->setLayout('exception')->setData(['exception' => $exception])->render(); break; } $this->setBody($body); }
/** * Method to render the view * * @return string The rendered view * * @since 1.0 * @throws \RuntimeException */ public function render() { $this->setData(['items' => $this->model->getItems()]); return parent::render(); }