geoproject-app/public/site/plugins/map-editor/index.php
isUnknown 32e8301d91
Some checks failed
Deploy / Build and Deploy to Production (push) Has been cancelled
feat: transform map-editor markers into Kirby subpages
Major refactoring of the map-editor plugin to store markers as Kirby
subpages instead of YAML data, enabling extensible block content.

Backend Changes:
- Add API routes for marker CRUD operations (GET, POST, PATCH, DELETE)
- Create marker.yml blueprint with content & position tabs
- Add markers section to map.yml blueprint
- Update useMapData to only handle center/zoom/background
- Create useMarkersApi composable for API communication

Frontend Changes:
- Refactor MapEditor.vue to support multi/single modes
- Multi mode: loads markers via API, redirects to Panel for editing
- Single mode: displays single marker for position tab in marker page
- Remove MarkerEditor.vue modal (replaced by Panel editing)
- Normalize position format handling (lon vs lng)

API Features:
- Session-based auth for Panel requests (no CSRF needed)
- Proper error handling and validation
- Markers created as listed pages (not drafts)
- Uses Kirby's data() method for JSON parsing

Documentation:
- Add IMPLEMENTATION_SUMMARY.md with technical details
- Add TESTING_CHECKLIST.md with 38 test cases

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-29 14:08:40 +01:00

38 lines
1.1 KiB
PHP

<?php
/**
* Map Editor Plugin for Kirby CMS
*
* Interactive map editor with MapLibre GL JS for creating
* print-ready maps with markers and rich content.
*/
Kirby::plugin('geoproject/map-editor', [
'fields' => [
'map-editor' => [
'props' => [
'defaultCenter' => function ($defaultCenter = [43.836699, 4.360054]) {
return $defaultCenter;
},
'defaultZoom' => function ($defaultZoom = 13) {
return $defaultZoom;
},
'maxMarkers' => function ($maxMarkers = 50) {
return $maxMarkers;
},
'mode' => function ($mode = 'multi') {
return $mode;
},
'latitude' => function ($latitude = null) {
return $latitude;
},
'longitude' => function ($longitude = null) {
return $longitude;
}
]
]
],
'api' => [
'routes' => require __DIR__ . '/api/routes.php'
]
]);