protected function renderInLayout(RequestApplicationInterface $app, $viewName, $params = [], $asResponse = false)
    {
        $view = $app->view;
        if (isset($this->layout)) {
            $layoutFile = $view->findViewFile($this->layout, $this);
        } else {
            $layoutFile = $view->findViewFile($view->layout, $this);
        }
        $content = $this->renderInternal($app, $viewName, $params, false, false);
        $rendered = $this->renderFile($app, $layoutFile, ['content' => $content]);
        if (!$asResponse) {
            return $rendered;
        }
        $app->response->setBody($rendered);
        return $app->response;
    }
protected function renderInLayout(RequestApplicationInterface $app, $viewName, $params = [], $asResponse = false)
    {
        $view = $app->view;
        if (isset($this->layout)) {
            $layoutFile = $view->findViewFile($this->layout, $this);
        } else {
            $layoutFile = $view->findViewFile($view->layout, $this);
        }
        $content = $this->renderInternal($app, $viewName, $params, false, false);
        $rendered = $this->renderFile($app, $layoutFile, ['content' => $content]);
        if (!$asResponse) {
            return $rendered;
        }
        $app->response->setBody($rendered);
        return $app->response;
    }
protected function renderInLayout ( RequestApplicationInterface $ app , $ viewName , $ params = [ ] , $ asResponse = false ) { $ view = $ app -> view ; if ( isset ( $ this -> layout ) ) { $ layoutFile = $ view -> findViewFile ( $ this -> layout , $ this ) ; } else { $ layoutFile = $ view -> findViewFile ( $ view -> layout , $ this ) ; } $ content = $ this -> renderInternal ( $ app , $ viewName , $ params , false , false ) ; $ rendered = $ this -> renderFile ( $ app , $ layoutFile , [ 'content' => $ content ] ) ; if ( ! $ asResponse ) { return $ rendered ; } $ app -> response -> setBody ( $ rendered ) ; return $ app -> response ; }
Render view in layout
@param RequestApplicationInterface $app
@param string                      $viewName
@param array                       $params
@param bool                        $asResponse
@return \Reaction\Web\ResponseBuilderInterface|string
Render view in layout