Set the compiled content.
public setContent ( $content, $snapshotName ) | ||
$content | Mixed The compiled content | |
$snapshotName | The name of the snapshot. The snapshot "last" is not valid |
private function convertItem(ItemInterface $item) { $this->eventDispatcher->dispatch('spress.before_convert', new Event\ContentEvent($item, ItemInterface::SNAPSHOT_RAW, ItemInterface::SNAPSHOT_PATH_RELATIVE)); $path = $item->getPath(ItemInterface::SNAPSHOT_PATH_RELATIVE); $ext = pathinfo($path, PATHINFO_EXTENSION); $result = $this->converterManager->convertContent($item->getContent(), $ext); $newPath = preg_replace('/\\.' . $ext . '$/', '.' . $result->getExtension(), $path); $item->setContent($result->getResult(), ItemInterface::SNAPSHOT_AFTER_CONVERT); $item->setPath($newPath, ItemInterface::SNAPSHOT_PATH_RELATIVE); $this->eventDispatcher->dispatch('spress.after_convert', new Event\ContentEvent($item, ItemInterface::SNAPSHOT_AFTER_CONVERT, ItemInterface::SNAPSHOT_PATH_RELATIVE)); $this->siteAttribute->setItem($item); }