File tree Expand file tree Collapse file tree 1 file changed +19
-3
lines changed
Expand file tree Collapse file tree 1 file changed +19
-3
lines changed Original file line number Diff line number Diff line change @@ -7,12 +7,28 @@ public function __construct(private \Municipio\PostObject\PostObjectInterface $p
77 {}
88 public function apply ():\Municipio \PostObject \PostObjectInterface |null {
99
10- if (!($ this ->post ->getSchemaProperty ('geo ' ) instanceof \Municipio \Schema \GeoCoordinates)) {
10+ /**
11+ * Hotfix: Manually get lat/lng.
12+ * Should be removed when https://github.com/helsingborg-stad/Municipio/pull/1403 is merged.
13+ */
14+
15+ $ geo = $ this ->post ->getSchemaProperty ('geo ' );
16+
17+ if (!$ geo ) {
18+ return $ this ->post ;
19+ }
20+
21+ if (is_string ($ geo )) {
22+ $ geo = unserialize ($ geo );
23+ }
24+
25+ if (isset ($ geo ['lat ' ], $ geo ['lng ' ])) {
26+ $ lat = $ geo ['lat ' ];
27+ $ lng = $ geo ['lng ' ];
28+ } else {
1129 return $ this ->post ;
1230 }
1331
14- $ lat = $ this ->post ->getSchemaProperty ('geo ' )['latitude ' ] ?? null ;
15- $ lng = $ this ->post ->getSchemaProperty ('geo ' )['longitude ' ] ?? null ;
1632 $ googleMapsLink = $ this ->getGoogleMapsLink ($ lat , $ lng );
1733
1834 $ this ->post ->openStreetMapData = [
You can’t perform that action at this time.
0 commit comments