예제 #1
0
 public function testRenderItem()
 {
     $path = $this->pagesDir . '/about/index.html';
     $fileInfo = new SplFileInfo($path, '', 'index.html');
     $fileItem = new FileItem($fileInfo, FileItem::TYPE_PAGE);
     $item = new PageItem($fileItem, $this->configuration);
     $item->setPostConverterContent($item->getPreConverterContent());
     $this->renderizer->renderItem($item);
     $this->assertStringStartsWith('<!DOCTYPE HTML>', $item->getPostLayoutContent());
 }
예제 #2
0
 private function renderPagination(array $payload, Paginator $paginator, FileItem $template)
 {
     if ($template) {
         $paginatorItemTemplate = new PageItem($template, $this->configuration);
         $paginatorItemTemplate->setPostConverterContent($paginatorItemTemplate->getPreConverterContent());
         if ($paginator->pageChanged() && $paginatorItemTemplate) {
             $payload['page'] = $paginatorItemTemplate->getPayload();
             $payload['paginator'] = $this->getPaginatorPayload($paginator);
             $event = $this->events->dispatchBeforeRenderPagination($this->renderizer, $payload, $paginatorItemTemplate);
             $this->renderizer->renderItem($paginatorItemTemplate, $event->getPayload());
             $this->events->dispatchAfterRenderPagination($this->renderizer, $payload, $paginatorItemTemplate);
             $relativePath = $this->getPageRelativePath($paginator->getCurrentPage());
             $paginatorItemTemplate->getFileItem()->setDestinationPaths([$relativePath]);
             $this->saveItem($paginatorItemTemplate);
         }
     }
     $paginator->nextItem();
 }