Skip to content

Commit

Permalink
fix: replace content types with schematype (#50)
Browse files Browse the repository at this point in the history
  • Loading branch information
thorbrink authored Aug 12, 2024
1 parent 9ece7e1 commit 418a92a
Show file tree
Hide file tree
Showing 4 changed files with 4 additions and 6 deletions.
1 change: 0 additions & 1 deletion source/php/Api/PostTransformer/DefaultTransformer.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
4 changes: 2 additions & 2 deletions source/php/Helper/GetPlacePostType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
3 changes: 1 addition & 2 deletions source/php/Helper/GetTaxonomies.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion views/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(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'
]
Expand Down

0 comments on commit 418a92a

Please sign in to comment.