mirror of
https://github.com/BookStackApp/BookStack.git
synced 2025-05-27 22:01:08 +03:00
Updated PR code to use isA and updated that function definition
Related to #2227
This commit is contained in:
parent
fe0e307313
commit
68489e5b44
@ -201,12 +201,10 @@ class Entity extends Ownable
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Allows checking of the exact class, Used to check entity type.
|
* Check if this instance or class is a certain type of entity.
|
||||||
* Cleaner method for is_a.
|
* Examples of $type are 'page', 'book', 'chapter'
|
||||||
* @param $type
|
|
||||||
* @return bool
|
|
||||||
*/
|
*/
|
||||||
public static function isA($type)
|
public static function isA(string $type): bool
|
||||||
{
|
{
|
||||||
return static::getType() === strtolower($type);
|
return static::getType() === strtolower($type);
|
||||||
}
|
}
|
||||||
|
@ -62,7 +62,7 @@ class BookContents
|
|||||||
$all->each(function (Entity $entity) use ($renderPages) {
|
$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') {
|
if ($renderPages && $entity->isA('page')) {
|
||||||
$entity->html = (new PageContent($entity))->render();
|
$entity->html = (new PageContent($entity))->render();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user