Skip to content

Commit

Permalink
Merge pull request #2135 from omeka/linked-resources-display
Browse files Browse the repository at this point in the history
Return nothing when resource has no subject values
  • Loading branch information
zerocrates authored Dec 18, 2023
2 parents e91bc65 + 9ad3d13 commit d7ff0fc
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -548,10 +548,19 @@ public function displaySubjectValues(array $options = [])
$perPage = $options['perPage'] ?? null;
$siteId = $options['siteId'] ?? null;

$subjectValuePropertiesItems = $adapter->getSubjectValueProperties($this->resource, 'items', $siteId);
$subjectValuePropertiesItemSets = $adapter->getSubjectValueProperties($this->resource, 'item_sets', $siteId);
$subjectValuePropertiesMedia = $adapter->getSubjectValueProperties($this->resource, 'media', $siteId);

if (!$subjectValuePropertiesItems && !$subjectValuePropertiesItemSets && !$subjectValuePropertiesMedia) {
// This resource has no subject values;
return null;
}

$resourcePropertiesAll = [
'items' => $adapter->getSubjectValueProperties($this->resource, 'items', $siteId),
'item_sets' => $adapter->getSubjectValueProperties($this->resource, 'item_sets', $siteId),
'media' => $adapter->getSubjectValueProperties($this->resource, 'media', $siteId),
'items' => $subjectValuePropertiesItems,
'item_sets' => $subjectValuePropertiesItemSets,
'media' => $subjectValuePropertiesMedia,
];
// Find the default resource property by detecting the first resource
// type that has properties.
Expand Down

0 comments on commit d7ff0fc

Please sign in to comment.