Add BC for importing older exported templates

We allow exporting templates as JSON and templates exported from the older plugin versions use thumbnail key for storing the image data.
[MAILPOET-2686]
This commit is contained in:
Rostislav Wolny
2021-10-20 13:41:00 +02:00
committed by Veljko V
parent 5134713c2d
commit dd0a19a314
2 changed files with 17 additions and 1 deletions

View File

@@ -49,7 +49,12 @@ class NewsletterTemplatesRepository extends Repository {
}
if (isset($data['thumbnail'])) {
$template->setThumbnail($data['thumbnail']);
// Backward compatibility for importing templates exported from older versions
if (strpos($data['thumbnail'], 'data:image') === 0) {
$data['thumbnail_data'] = $data['thumbnail'];
} else {
$template->setThumbnail($data['thumbnail']);
}
}
if (isset($data['thumbnail_data'])) {