feat: display custom marker icons on parent map
API now returns iconUrl and iconSize for each marker, allowing custom marker icons defined in marker.yml to be displayed on the map-editor field of the parent map page. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
This commit is contained in:
parent
68d3142126
commit
575534d182
3 changed files with 629 additions and 20595 deletions
|
|
@ -55,6 +55,15 @@ return [
|
|||
// Format markers for response
|
||||
$markers = [];
|
||||
foreach ($markerPages as $marker) {
|
||||
// Get custom icon if available
|
||||
$iconFile = $marker->markerIcon()->toFile();
|
||||
$iconUrl = $iconFile ? $iconFile->url() : null;
|
||||
|
||||
// Get icon size if set
|
||||
$iconSize = $marker->markerIconSize()->isNotEmpty()
|
||||
? (int) $marker->markerIconSize()->value()
|
||||
: 40;
|
||||
|
||||
$markers[] = [
|
||||
'id' => $marker->id(),
|
||||
'slug' => $marker->slug(),
|
||||
|
|
@ -64,7 +73,9 @@ return [
|
|||
'lon' => (float) $marker->longitude()->value()
|
||||
],
|
||||
'num' => $marker->num(),
|
||||
'panelUrl' => (string) $marker->panel()->url()
|
||||
'panelUrl' => (string) $marker->panel()->url(),
|
||||
'iconUrl' => $iconUrl,
|
||||
'iconSize' => $iconSize
|
||||
];
|
||||
}
|
||||
|
||||
|
|
@ -173,6 +184,13 @@ return [
|
|||
// Publish the page as listed with the correct num
|
||||
$newMarker->changeStatus('listed', $nextNum);
|
||||
|
||||
// Get custom icon if available (new markers won't have one initially)
|
||||
$iconFile = $newMarker->markerIcon()->toFile();
|
||||
$iconUrl = $iconFile ? $iconFile->url() : null;
|
||||
$iconSize = $newMarker->markerIconSize()->isNotEmpty()
|
||||
? (int) $newMarker->markerIconSize()->value()
|
||||
: 40;
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'data' => [
|
||||
|
|
@ -185,7 +203,9 @@ return [
|
|||
'lon' => $lon
|
||||
],
|
||||
'num' => $nextNum,
|
||||
'panelUrl' => (string) $newMarker->panel()->url()
|
||||
'panelUrl' => (string) $newMarker->panel()->url(),
|
||||
'iconUrl' => $iconUrl,
|
||||
'iconSize' => $iconSize
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
@ -268,6 +288,13 @@ return [
|
|||
'longitude' => $lon
|
||||
]);
|
||||
|
||||
// Get custom icon if available
|
||||
$iconFile = $marker->markerIcon()->toFile();
|
||||
$iconUrl = $iconFile ? $iconFile->url() : null;
|
||||
$iconSize = $marker->markerIconSize()->isNotEmpty()
|
||||
? (int) $marker->markerIconSize()->value()
|
||||
: 40;
|
||||
|
||||
return [
|
||||
'status' => 'success',
|
||||
'data' => [
|
||||
|
|
@ -280,7 +307,9 @@ return [
|
|||
'lon' => $lon
|
||||
],
|
||||
'num' => $marker->num(),
|
||||
'panelUrl' => '/panel/pages/' . $marker->id()
|
||||
'panelUrl' => '/panel/pages/' . $marker->id(),
|
||||
'iconUrl' => $iconUrl,
|
||||
'iconSize' => $iconSize
|
||||
]
|
||||
]
|
||||
];
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
File diff suppressed because one or more lines are too long
Loading…
Add table
Add a link
Reference in a new issue