diff --git a/src/widgets/BasePublication.php b/src/widgets/BasePublication.php index ac338b7..cb9efda 100644 --- a/src/widgets/BasePublication.php +++ b/src/widgets/BasePublication.php @@ -250,10 +250,22 @@ protected function renderHtmlByPublicationItem($publicationItem) { if ($this->teaser) { $properties = Json::decode($publicationItem->teaser_widget_json); + + // Check if properties is an array + if (empty($properties) || !is_array($properties)) { + $properties = []; + } + // allow usage of content variables in teaser $properties['content'] = Json::decode($publicationItem->content_widget_json); } else { $properties = Json::decode($publicationItem->content_widget_json); + + // Check if properties is an array + if (empty($properties) || !is_array($properties)) { + $properties = []; + } + $properties['teaser'] = Json::decode($publicationItem->teaser_widget_json); } @@ -272,4 +284,4 @@ protected function renderHtmlByPublicationItem($publicationItem) return $publicationWidget; } -} \ No newline at end of file +}