public function body($content = null) { if ($content === null) { return $this->_body; } return $this->_body = $content; }
/** * Instantiates the correct view class, hands it its data, and uses it to render the view output. * * @param string $view View to use for rendering * @param string $layout Layout to use * @return \Cake\Network\Response A response object containing the rendered view. * @link http://book.cakephp.org/3.0/en/controllers.html#rendering-a-view */ public function render($view = null, $layout = null) { $builder = $this->viewBuilder(); if (!$builder->templatePath()) { $builder->templatePath($this->_viewPath()); } if (!empty($this->request->params['bare'])) { $builder->autoLayout(false); } $builder->className($this->viewClass); $this->autoRender = false; $event = $this->dispatchEvent('Controller.beforeRender'); if ($event->result instanceof Response) { return $event->result; } if ($event->isStopped()) { return $this->response; } if ($builder->template() === null && isset($this->request->params['action'])) { $builder->template($this->request->params['action']); } $this->View = $this->createView(); $this->response->body($this->View->render($view, $layout)); return $this->response; }