diff --git a/app/Entities/Entity.php b/app/Entities/Entity.php index 120290d8f..cc7df46d4 100644 --- a/app/Entities/Entity.php +++ b/app/Entities/Entity.php @@ -201,12 +201,10 @@ class Entity extends Ownable } /** - * Allows checking of the exact class, Used to check entity type. - * Cleaner method for is_a. - * @param $type - * @return bool + * Check if this instance or class is a certain type of entity. + * Examples of $type are 'page', 'book', 'chapter' */ - public static function isA($type) + public static function isA(string $type): bool { return static::getType() === strtolower($type); } diff --git a/app/Entities/Managers/BookContents.php b/app/Entities/Managers/BookContents.php index 779a9292b..52447e43b 100644 --- a/app/Entities/Managers/BookContents.php +++ b/app/Entities/Managers/BookContents.php @@ -62,7 +62,7 @@ class BookContents $all->each(function (Entity $entity) use ($renderPages) { $entity->setRelation('book', $this->book); - if ($renderPages && get_class($entity) == 'BookStack\Entities\Page') { + if ($renderPages && $entity->isA('page')) { $entity->html = (new PageContent($entity))->render(); } });