Render page content when getTree() is called with a true $renderPages
argument.
/**
* Get the contents as a sorted collection tree.
- * TODO - Support $renderPages option
*/
public function getTree(bool $showDrafts = false, bool $renderPages = false): Collection
{
}
});
- $all->each(function (Entity $entity) {
+ $all->each(function (Entity $entity) use ($renderPages) {
$entity->setRelation('book', $this->book);
+
+ if ($renderPages && get_class($entity) == 'BookStack\Entities\Page') {
+ $entity->html = (new PageContent($entity))->render();
+ }
});
return collect($chapters)->concat($lonePages)->sortBy($this->bookChildSortFunc());