mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-29 09:21:20 +03:00
Merge branch 'renderpages' of git://github.com/mr-vinn/BookStack into mr-vinn-renderpages
This commit is contained in:
commit
fe0e307313
@ -41,7 +41,6 @@ class BookContents
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Get the contents as a sorted collection tree.
|
* Get the contents as a sorted collection tree.
|
||||||
* TODO - Support $renderPages option
|
|
||||||
*/
|
*/
|
||||||
public function getTree(bool $showDrafts = false, bool $renderPages = false): Collection
|
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);
|
$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());
|
return collect($chapters)->concat($lonePages)->sortBy($this->bookChildSortFunc());
|
||||||
|
Loading…
x
Reference in New Issue
Block a user