diff --git a/plugins/MapModule/src/Controller/MapeditorsController.php b/plugins/MapModule/src/Controller/MapeditorsController.php index c4f669d334..a9e9194416 100755 --- a/plugins/MapModule/src/Controller/MapeditorsController.php +++ b/plugins/MapModule/src/Controller/MapeditorsController.php @@ -110,6 +110,10 @@ public function view($id = null) { $MapForAngular = new MapForAngular($map); $map = $MapForAngular->toArray(); + $config = $MapsTable->getMapeditorSettings($map['Map']['json_data']); + $map['Mapeditor'] = [ + 'background' => $config['Mapeditor']['background'] + ]; $acl = [ 'hosts' => [ @@ -2007,6 +2011,10 @@ public function mapDetails($id) { $MapForAngular = new MapForAngular($map); $map = $MapForAngular->toArray(); + $config = $MapsTable->getMapeditorSettings($map['Map']['json_data']); + $map['Mapeditor'] = [ + 'background' => $config['Mapeditor']['background'] + ]; $this->set('map', $map); $this->viewBuilder()->setOption('serialize', ['map']); diff --git a/plugins/MapModule/src/Model/Table/MapsTable.php b/plugins/MapModule/src/Model/Table/MapsTable.php index 6b0e601596..aa7915f3c3 100644 --- a/plugins/MapModule/src/Model/Table/MapsTable.php +++ b/plugins/MapModule/src/Model/Table/MapsTable.php @@ -2299,6 +2299,12 @@ public function getDefaultMapeditorSettings() { 'helplines' => [ 'enabled' => true, 'size' => 15 + ], + 'background' => [ + 'position_x' => 0, + 'position_y' => 0, + 'width' => null, + 'height' => null ] ] ]; @@ -2309,9 +2315,15 @@ public function getDefaultMapeditorSettings() { * @return array|mixed */ public function getMapeditorSettings($config) { + $defaults = $this->getDefaultMapeditorSettings(); if (empty($config)) { - return $this->getDefaultMapeditorSettings(); + return $defaults; } - return json_decode($config, true); + $config = json_decode($config, true); + + return Hash::merge( + $defaults, + $config + ); } } diff --git a/plugins/MapModule/templates/Mapeditors/edit.php b/plugins/MapModule/templates/Mapeditors/edit.php index ec0740449d..90b93c393f 100644 --- a/plugins/MapModule/templates/Mapeditors/edit.php +++ b/plugins/MapModule/templates/Mapeditors/edit.php @@ -47,10 +47,12 @@

- - {{map.Map.name}} + + {{map.Map.name}}

-
+
+
+
+
+ + : + + +
Acl->hasPermission('index', 'maps', 'mapmodule')): ?> + class="btn btn-default btn-xs ml-5 mr-1 shadow-0"> @@ -136,8 +148,16 @@ class="btn btn-default btn-xs mr-1 shadow-0"> id="mainMapContainer">
- +
+ +
+
diff --git a/plugins/MapModule/templates/Mapeditors/view_directive.php b/plugins/MapModule/templates/Mapeditors/view_directive.php index f4788325d1..e2cc450329 100644 --- a/plugins/MapModule/templates/Mapeditors/view_directive.php +++ b/plugins/MapModule/templates/Mapeditors/view_directive.php @@ -22,9 +22,15 @@ // License agreement and license key will be shipped with the order // confirmation. ?> -<?= __('{0} Map background image is not available!!!', '⚠'); ?> - +
+ <?= __('{0} Map background image is not available!!!', '⚠'); ?> +