Skip to content

Commit

Permalink
Update Content.php
Browse files Browse the repository at this point in the history
  • Loading branch information
bobdenotter committed Sep 18, 2023
1 parent 3a0a009 commit a958b8f
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions src/Entity/Content.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
use Bolt\Entity\Field\SetField;
use Bolt\Enum\Statuses;
use Bolt\Repository\FieldRepository;
use Bolt\Twig\ContentExtension;
use Bolt\Utils\ContentHelper;
use Bolt\Utils\Excerpt;
use DateTimeZone;
Expand Down Expand Up @@ -887,7 +888,11 @@ private function getFieldValuesFromDefinition(): ?array
*/
public function setTitle(): self
{
$this->title = Excerpt::getExcerpt($this->getExtras()['title'], 191);
if ($this->contentExtension instanceof ContentExtension) {
$this->title = Excerpt::getExcerpt($this->getExtras()['title'], 191);
} else {

Check failure on line 893 in src/Entity/Content.php

View workflow job for this annotation

GitHub Actions / PHPStan

Else branch is unreachable because previous condition is always true.

Check failure on line 893 in src/Entity/Content.php

View workflow job for this annotation

GitHub Actions / PHPStan

Else branch is unreachable because previous condition is always true.
$this->title = '';
}

return $this;
}
Expand All @@ -903,7 +908,11 @@ public function getListFormat(): ?string
*/
public function setListFormat(): self
{
$this->listFormat = Excerpt::getExcerpt($this->getExtras()['listFormat'], 191);
if ($this->contentExtension instanceof ContentExtension) {
$this->listFormat = Excerpt::getExcerpt($this->getExtras()['listFormat'], 191);
} else {

Check failure on line 913 in src/Entity/Content.php

View workflow job for this annotation

GitHub Actions / PHPStan

Else branch is unreachable because previous condition is always true.

Check failure on line 913 in src/Entity/Content.php

View workflow job for this annotation

GitHub Actions / PHPStan

Else branch is unreachable because previous condition is always true.
$this->title = '';
}

return $this;
}
Expand Down

0 comments on commit a958b8f

Please sign in to comment.