diff --git a/source/php/Api/PostTransformer/DefaultTransformer.php b/source/php/Api/PostTransformer/DefaultTransformer.php index a2e3b71..5e18241 100644 --- a/source/php/Api/PostTransformer/DefaultTransformer.php +++ b/source/php/Api/PostTransformer/DefaultTransformer.php @@ -10,7 +10,6 @@ public function __construct(private SettingsInterface $settings) public function transform($post): mixed { - $post = \Municipio\Helper\ContentType::complementPlacePost($post); $post = \Municipio\Helper\Post::preparePostObject($post); $post->osmFilterValues = $this->addOsmFilteringCapabilities($post); diff --git a/source/php/Helper/GetPlacePostType.php b/source/php/Helper/GetPlacePostType.php index 81c02ed..a149ea9 100644 --- a/source/php/Helper/GetPlacePostType.php +++ b/source/php/Helper/GetPlacePostType.php @@ -23,8 +23,8 @@ private function filterPostTypes(): array $filteredPostTypes = []; 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); $filteredPostTypes[$postTypeObject->name] = $postTypeObject->label; } diff --git a/source/php/Helper/GetTaxonomies.php b/source/php/Helper/GetTaxonomies.php index 14c4390..2aaa57d 100644 --- a/source/php/Helper/GetTaxonomies.php +++ b/source/php/Helper/GetTaxonomies.php @@ -76,9 +76,8 @@ public function getAllTermsFromTaxonomy(string $taxonomy, string $output = 'name 'taxonomy' => $taxonomy, 'hide_empty' => true, ]); - - if (!empty($terms)) { + if (!is_wp_error($terms) && !empty($terms)) { if ($output === 'object') { return $terms; } diff --git a/views/collection.blade.php b/views/collection.blade.php index 9b99e07..d8400ce 100644 --- a/views/collection.blade.php +++ b/views/collection.blade.php @@ -3,7 +3,7 @@ 'containerAware' => true, 'bordered' => true, 'attributeList' => [ - 'data-js-map-location' => !empty($place->schemaData['place']['pin']) ? json_encode(array_merge($place->schemaData['place']['pin'], ['id' => 'osm-' . $place->id])) : "", + 'data-js-map-location' => !empty($place->openStreetMapData['pin']) ? json_encode($place->openStreetMapData['pin']) : "", 'id' => 'osm-' . $place->id, 'tabindex' => '0' ]