Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set list_format in ContentEditController save function #3516

Merged
merged 2 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/Controller/Backend/ContentEditController.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,12 @@ public function save(?Content $originalContent = null, ?ContentValidatorInterfac
$this->em->persist($content);
$this->em->flush();

// Set the list_format of the Record in the bolt_content table. This has to be done in a 2nd iteration because
// $content does not have id set untill the Entity Manager is flushed.
$content->setListFormat();
$this->em->persist($content);
$this->em->flush();

$urlParams = [
'id' => $content->getId(),
'edit_locale' => $this->getEditLocale($content) ?: null,
Expand Down
2 changes: 1 addition & 1 deletion src/Entity/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -911,7 +911,7 @@ public function setListFormat(): self
if ($this->contentExtension instanceof ContentExtension) {
$this->listFormat = Excerpt::getExcerpt($this->getExtras()['listFormat'], 191);
} else {
$this->title = '';
$this->listFormat = '';
}

return $this;
Expand Down
Loading