Skip to content
Snippets Groups Projects
Commit 59f64d9a authored by ekes's avatar ekes
Browse files

Actually fixes #200 adds label_field => label_value to API

However ideally we only do this with a API version increment.
parent 92ad287d
No related branches found
No related tags found
No related merge requests found
...@@ -177,6 +177,19 @@ class RadarServicesEntityResourceController extends ServicesEntityResourceContro ...@@ -177,6 +177,19 @@ class RadarServicesEntityResourceController extends ServicesEntityResourceContro
// For referenced entities only return the URI. // For referenced entities only return the URI.
if ($id = $property->getIdentifier()) { if ($id = $property->getIdentifier()) {
$data[$name] = $this->get_resource_reference($property->type(), $id); $data[$name] = $this->get_resource_reference($property->type(), $id);
// So in common with some of our other errors the entity won't load
// here as it's a UUID. Replacing the entity controller would
// probably do it? For now fix the issue at hand.
$entity_info = entity_get_info($property->type());
$entities = entity_uuid_load($property->type(), [$id]);
$entity_label = empty($entity_info['entity keys']['label']) ? 'label' : $entity_info['entity keys']['label'];
if (!empty($entities)) {
$entity = reset($entities);
$data[$name][$entity_label] = entity_label($property->type(), $entity);
}
else {
$data[$name][$entity_label] = '';
}
} }
} }
elseif ($property instanceof EntityValueWrapper) { elseif ($property instanceof EntityValueWrapper) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment