change the API response to include metadata `semantic url`

This commit is contained in:
vnmedeiros 2019-06-04 14:43:01 -03:00
parent 0d5bc74105
commit 3c1af06129
2 changed files with 6 additions and 1 deletions

View File

@ -123,6 +123,7 @@ class REST_Items_Controller extends REST_Controller {
$item_array['metadata'][ $slug ]['value'] = $item_metadata_array['value'];
$item_array['metadata'][ $slug ]['value_as_html'] = $item_metadata_array['value_as_html'];
$item_array['metadata'][ $slug ]['value_as_string'] = $item_metadata_array['value_as_string'];
$item_array['metadata'][ $slug ]['semantic_uri'] = $item_metadata_array['metadatum']['semantic_uri'];
$item_array['metadata'][ $slug ]['multiple'] = $metadatum->get_multiple();
$item_array['metadata'][ $slug ]['mapping'] = $metadatum->get_exposer_mapping();
@ -215,7 +216,11 @@ class REST_Items_Controller extends REST_Controller {
}
// \error_log("DEBUG-1:");
// \error_log(\json_encode($item_arr));
$item_arr = apply_filters('tainacan-api-items-prepare-for-response', $item_arr, $item, $request);
// \error_log("DEBUG-2:");
// \error_log(\json_encode($item_arr));
return $item_arr;
}

View File

@ -327,7 +327,7 @@ class Mappers_Handler {
$mapped_meta[ $mapped_slug ] = $meta;
$mapped_meta[ $mapped_slug ]['semantic_url'] = $url;
$mapped_meta[ $mapped_slug ]['semantic_uri'] = $url;
$mapped_meta[ $mapped_slug ]['name'] = $label;
$mapped_meta[ $mapped_slug ]['slug'] = $mapped_slug;
}