Jarves\PageResponseFactory::createFromPage PHP Method

createFromPage() public method

public createFromPage ( Node | string | integer $page, string | array | null $contents = null ) : PageResponse
$page Jarves\Model\Node | string | integer Node model, url or node id. Use Jarves\Model\Node::createPage()
$contents string | array | null
return PageResponse
    public function createFromPage($page, $contents = null)
    {
        $page = $this->pageStack->getPage($page);
        if (!$page) {
            throw new \InvalidArgumentException('Can not find page.');
        }
        $this->pageStack->setCurrentPage($page);
        $pageResponse = new PageResponse('', 200, [], $this->pageStack, $this->jarves, $this->stopwatch, $this->assetCompilerContainer, $this->eventDispatcher, $this->templating, $this->editMode);
        $this->pageStack->setPageResponse($pageResponse);
        if (null !== $contents) {
            $pageResponse->setPageContent($contents);
        }
        return $pageResponse;
    }