Skip to content

Commit

Permalink
EAD3: Display physical descriptions primarily from structured fields
Browse files Browse the repository at this point in the history
  • Loading branch information
mshroom committed Jan 28, 2025
1 parent 40a86e3 commit 47c89ca
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions module/Finna/src/Finna/RecordDriver/SolrEad3.php
Original file line number Diff line number Diff line change
Expand Up @@ -1138,8 +1138,8 @@ public function getPhysicalDescriptions()
if (!isset($xml->did)) {
return [];
}
$results = $this->getDisplayLabel($xml->did, 'physdesc');
$localeResults = $this->getDisplayLabel($xml->did, 'physdesc', true);
$results = $localeResults = [];
// Check structured physical descriptions first
foreach ($xml->did->physdescstructured ?? [] as $desc) {
$lang = $this->detectNodeLanguage($desc);
$quantity = trim((string)($desc->quantity ?? ''));
Expand All @@ -1151,8 +1151,8 @@ public function getPhysicalDescriptions()
}
}
}

return $localeResults ?: $results;
// If no structured descriptions were found, use unstructured descriptions
return $localeResults ?: $results ?: $this->getDisplayLabel($xml->did, 'physdesc');
}

/**
Expand Down

0 comments on commit 47c89ca

Please sign in to comment.