+ }
+
+ /**
+ * Sort the parent of the given entity, if any auto sort actions are set for it.
+ * Typical ran during create/update/insert events.
+ */
+ public function sortParent(Entity $entity): void
+ {
+ if ($entity instanceof BookChild) {
+ $book = $entity->book;
+ $this->bookSorter->runBookAutoSort($book);
+ }
+ }
+
+ protected function updateDescription(Entity $entity, array $input): void
+ {
+ if (!in_array(HasHtmlDescription::class, class_uses($entity))) {
+ return;
+ }
+
+ /** @var HasHtmlDescription $entity */
+ if (isset($input['description_html'])) {
+ $entity->description_html = HtmlDescriptionFilter::filterFromString($input['description_html']);
+ $entity->description = html_entity_decode(strip_tags($input['description_html']));
+ } else if (isset($input['description'])) {
+ $entity->description = $input['description'];
+ $entity->description_html = '';
+ $entity->description_html = $entity->descriptionHtml();
+ }