コード例 #1
0
 /**
  * Preview a page.
  *
  * @param ViewTemplate            $template
  * @param PageRepositoryInterface $pages
  * @param                         $id
  * @return null|\Symfony\Component\HttpFoundation\Response
  */
 public function preview(ViewTemplate $template, PageRepositoryInterface $pages, $id)
 {
     if (!($page = $pages->findByStrId($id))) {
         abort(404);
     }
     $page->setAttribute('enabled', true);
     $type = $page->getType();
     $handler = $type->getHandler();
     $template->set('page', $page);
     $handler->make($page);
     return $page->getResponse();
 }