Skip to content

Commit

Permalink
feat: adapt to municipios new schema type formatting (#37)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorbrink authored Jun 14, 2024
1 parent 5a4860b commit 15d9203
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
4 changes: 2 additions & 2 deletions source/php/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ public function postTypes($field)
$postTypes = get_post_types();
$arr = [];
foreach ($postTypes as $postType) {
$contentType = \Municipio\Helper\ContentType::getContentType($postType);
if (is_object($contentType) && $contentType->getKey() == 'place') {
$schemaType = get_field('schema', $postType . '_options');
if ($schemaType === 'Place') {
$postTypeObject = get_post_type_object($postType);
$arr[$postTypeObject->name] = $postTypeObject->label;
}
Expand Down
3 changes: 1 addition & 2 deletions source/php/Module/OpenStreetMap.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function data(): array
}
$places = $this->getPlacePosts($termsToShow, $taxonomyToShow, $postTypeToShow);
} else {
$places = $this->buildPlacePosts($secondaryQuery->posts);
$places = $secondaryQuery->posts;
}
$data['isFullWidth'] = $fields['mod_osm_full_width'] ?? false;
$data['places'] = $places;
Expand Down Expand Up @@ -122,7 +122,6 @@ private function getPlacePosts($termsToShow, $taxonomyToShow, $postTypeToShow)
private function buildPlacePosts($posts)
{
foreach ($posts as &$post) {
$post = \Municipio\Helper\ContentType::complementPlacePost($post);
$post = \Municipio\Helper\Post::preparePostObject($post);
}

Expand Down
2 changes: 1 addition & 1 deletion source/php/Module/views/partials/collection.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
'containerAware' => true,
'bordered' => true,
'attributeList' => [
'data-js-map-location' => !empty($place->schemaData['place']['pin']) ? json_encode($place->schemaData['place']['pin']) : "",
'data-js-map-location' => !empty($place->openStreetMapData['pin']) ? json_encode($place->openStreetMapData['pin']) : "",
]
])
@if (!empty($place->callToActionItems['floating']))
Expand Down

0 comments on commit 15d9203

Please sign in to comment.