예제 #1
0
 /**
  * Return the HTML necessary to render all block forms.
  *
  * @param SitePageRepresentation $sitePage
  */
 public function forms(SitePageRepresentation $sitePage)
 {
     $html = '<div id="blocks">';
     foreach ($sitePage->blocks() as $block) {
         $html .= $this->form($block);
     }
     $html .= '</div>';
     return $html;
 }
예제 #2
0
 /**
  * Set the current, previous, and next page.
  *
  * @param SitePageRepresentation $page
  */
 public function setPage(SitePageRepresentation $page)
 {
     $this->page = $page;
     $linkedPages = $page->site()->linkedPages();
     if (!array_key_exists($page->id(), $linkedPages)) {
         // Page not found in navigation. Don't attempt to find prev/next.
         $this->pageInNav = false;
         return;
     }
     // Iterate the linked pages, setting the previous and next pages, if any.
     while ($linkedPage = current($linkedPages)) {
         if ($page->id() === $linkedPage->id()) {
             $this->nextPage = next($linkedPages);
             break;
         }
         $this->prevPage = $linkedPage;
         next($linkedPages);
     }
 }