Skip to content

Commit 17d1ee1

Browse files
authored
Merge pull request #3516 from bolt/feature/set-list-format-when-saving
Set list_format in ContentEditController save function
2 parents 371451f + abd9e2e commit 17d1ee1

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/Controller/Backend/ContentEditController.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -214,6 +214,12 @@ public function save(?Content $originalContent = null, ?ContentValidatorInterfac
214214
$this->em->persist($content);
215215
$this->em->flush();
216216

217+
// Set the list_format of the Record in the bolt_content table. This has to be done in a 2nd iteration because
218+
// $content does not have id set untill the Entity Manager is flushed.
219+
$content->setListFormat();
220+
$this->em->persist($content);
221+
$this->em->flush();
222+
217223
$urlParams = [
218224
'id' => $content->getId(),
219225
'edit_locale' => $this->getEditLocale($content) ?: null,

src/Entity/Content.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -911,7 +911,7 @@ public function setListFormat(): self
911911
if ($this->contentExtension instanceof ContentExtension) {
912912
$this->listFormat = Excerpt::getExcerpt($this->getExtras()['listFormat'], 191);
913913
} else {
914-
$this->title = '';
914+
$this->listFormat = '';
915915
}
916916

917917
return $this;

0 commit comments

Comments
 (0)