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

Feature/ensure array #28

Merged
merged 2 commits into from
Apr 18, 2023
Merged
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
14 changes: 13 additions & 1 deletion src/widgets/BasePublication.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand All @@ -272,4 +284,4 @@ protected function renderHtmlByPublicationItem($publicationItem)

return $publicationWidget;
}
}
}