I’ve recently to version 3.2.1 and everything in my custom module works fine, except that when i link one property to an Omeka resource i don’t see the rendered title anymore, but the json of the resource:
In the past everything worked fine with this function:
/**
* Manage the parsing of the title.
*
* @param Event $event
*/
public function handleResourceTitle(Event $event): void
{
$resource = $event->getTarget();
$template = $resource->resourceTemplate();
if ($template && $property = $template->titleProperty()) {
$title = $resource->value($property->term());
$properties = json_decode($title, true);
$event->setParam('title', (string) $title);
if(isset($properties[0]['@type'])){
$values = [];
foreach ($properties[0] as $key => $val) {
if (is_array($val) || is_object($val)){
foreach ($val as $innerKey => $innerVal) {
if($innerVal['@value']){
$values[$key] = $innerVal['@value'];
continue;
}
if($innerVal['label']){
$values[$key] = $innerVal['label'];
continue;
}
foreach ($innerVal as $secondKey => $secondVal) {
$values[$key] = $secondVal['@value'];
if($secondVal['@value']){
$values[$key] = $secondVal['@value'];
}
if($secondVal['label']){
$values[$key] = $secondVal['label'];
}
}
}
}
}
$cleanedTitle = implode('; ', $values);
$event->setParam('title', (string) $cleanedTitle);
}
else {
$event->setParam('title', (string) $title);
}
}
}
How can i fix this?