Skip to content

Commit 3d84b2d

Browse files
committed
#27 add the intro images in articles
1 parent cc54eff commit 3d84b2d

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

src/administrator/components/com_ccm/src/Model/MigrationModel.php

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -416,6 +416,11 @@ private function convertCcmToTargetCms($ccmItems, $targetCms, $targetType) {
416416

417417
if (!empty($value) && $format) {
418418
switch ($format) {
419+
case 'image':
420+
$oldId = $ccmItem[$ccmMap['ccm']] ?? null;
421+
$fileMap = $this->migrationMap["media"]['files'][$oldId] ?? [];
422+
$value = [ $ccmMap['field'] => ($fileMap['newUrl'] ?? null) ];
423+
break;
419424
case 'link_builder':
420425
// If this is a custom link menu-item, use the original URL instead of the template
421426
if (isset($ccmItem['type']) && $ccmItem['type'] === 'custom') {
@@ -631,6 +636,15 @@ private function migrateItemsToTargetCms($targetCms, $targetType, $ccmToTargetIt
631636

632637
$newUrl = $newThumbPath ?: $newPath;
633638
$this->migrationMap[$targetType]['urls'][$oldUrl] = $newUrl;
639+
640+
// for intro/featured image
641+
if (!isset($this->migrationMap[$targetType]['files'])) {
642+
$this->migrationMap[$targetType]['files'] = [];
643+
}
644+
$this->migrationMap[$targetType]['files'][$oldId] = [
645+
'oldUrl' => $oldUrl,
646+
'newUrl' => $newUrl
647+
];
634648
}
635649
} else {
636650
throw new \RuntimeException('Error migrating item #' . ($idx + 1) . ' - HTTP ' . $response->code . ': ' . $response->body);

src/administrator/components/com_ccm/src/Schema/joomla-ccm.json

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,11 @@
5252
"publish_up": null,
5353
"publish_down": null,
5454
"image": "image",
55-
"images": "images",
55+
"images": {
56+
"ccm": "featured_image",
57+
"format": "image",
58+
"field": "image_intro"
59+
},
5660
"version": null,
5761
"metakey": null,
5862
"metadesc": null,

src/administrator/components/com_ccm/src/Schema/wordpress-ccm.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"global_ID": "uid",
5353
"featured_image": "image",
5454
"post_thumbnail": "images",
55-
"featured_media": null,
55+
"featured_media": "featured_image",
5656
"format": null,
5757
"geo": null,
5858
"menu_order": null,
@@ -122,7 +122,7 @@
122122
"global_ID": "uid",
123123
"featured_image": "image",
124124
"post_thumbnail": "images",
125-
"featured_media": null,
125+
"featured_media": "featured_image",
126126
"format": null,
127127
"geo": null,
128128
"menu_order": null,

0 commit comments

Comments
 (0)