[ENTITY][Note] Added function getRenderedSplit, return an array of paragraphs/line breaks

[PLUGINS][Favourite] Foreign keys now properly defined on schema

[CARDS][Note] Note text is now hidden by default if too many paragraphs/line breaks are present, BlogCollection plugin will certainly need this feature
This commit is contained in:
2022-02-04 16:03:49 +00:00
parent fb76775716
commit 4dd976eb22
5 changed files with 51 additions and 4 deletions

View File

@@ -286,6 +286,11 @@ class Note extends Entity
return !\is_null($this->getLanguageId()) ? Language::getById($this->getLanguageId())->getLocale() : null;
}
public function getRenderedSplit(): array
{
return preg_split('/(<\s*p\s*\/?>)|(<\s*br\s*\/?>)|(\s\s+)|(<\s*\/p\s*\/?>)/', $this->getRendered(), -1, PREG_SPLIT_NO_EMPTY);
}
public static function getAllNotesByActor(Actor $actor): array
{
// TODO: Enforce scoping on the notes before returning