X-Git-Url: http://source.bookstackapp.com/bookstack/blobdiff_plain/898cedf5362a43afcee85cf24c8352240cb54690..refs/pull/2376/head:/app/Entities/Managers/BookContents.php diff --git a/app/Entities/Managers/BookContents.php b/app/Entities/Managers/BookContents.php index 8b8d02c1d..52447e43b 100644 --- a/app/Entities/Managers/BookContents.php +++ b/app/Entities/Managers/BookContents.php @@ -41,7 +41,6 @@ class BookContents /** * Get the contents as a sorted collection tree. - * TODO - Support $renderPages option */ public function getTree(bool $showDrafts = false, bool $renderPages = false): Collection { @@ -60,8 +59,12 @@ class BookContents } }); - $all->each(function (Entity $entity) { + $all->each(function (Entity $entity) use ($renderPages) { $entity->setRelation('book', $this->book); + + if ($renderPages && $entity->isA('page')) { + $entity->html = (new PageContent($entity))->render(); + } }); return collect($chapters)->concat($lonePages)->sortBy($this->bookChildSortFunc());