Skip to content

Commit

Permalink
Fix overwritten code from merge with master
Browse files Browse the repository at this point in the history
  • Loading branch information
chrizzor committed May 17, 2023
1 parent d8394fd commit 9b425be
Showing 1 changed file with 19 additions and 7 deletions.
26 changes: 19 additions & 7 deletions Classes/Common/MetsDocument.php
Original file line number Diff line number Diff line change
Expand Up @@ -634,7 +634,7 @@ class_exists($class)
->execute();
$subentriesResult = $subentries->fetchAll();
// We need a \DOMDocument here, because SimpleXML doesn't support XPath functions properly.
$domNode = dom_import_simplexml($this->dmdSec[$dmdId]['xml']);
$domNode = dom_import_simplexml($this->mdSec[$dmdId]['xml']);
$domXPath = new \DOMXPath($domNode->ownerDocument);
$this->registerNamespaces($domXPath);
// OK, now make the XPath queries.
Expand All @@ -658,7 +658,7 @@ class_exists($class)
}
}
} elseif (!($values instanceof \DOMNodeList)) {
$metadata[$resArray['index_name']] = [trim((string)$values->nodeValue)];
$metadata[$resArray['index_name']] = [trim((string)$values)];
}
}
// Set default value if applicable.
Expand Down Expand Up @@ -692,14 +692,26 @@ class_exists($class)
}
}
}
// Extract metadata only from first supported dmdSec.
$hasSupportedMetadata = true;
break;
$hasMetadataSection[$mdSectionType] = true;
}
if ($hasSupportedMetadata) {
// Set title to empty string if not present.
if (empty($metadata['title'][0])) {
$metadata['title'][0] = '';
$metadata['title_sorting'][0] = '';
}
// Set title_sorting to title as default.
if (empty($metadata['title_sorting'][0])) {
$metadata['title_sorting'][0] = $metadata['title'][0];
}
// Set date to empty string if not present.
if (empty($metadata['date'][0])) {
$metadata['date'][0] = '';
}var_dump($metadata);
// Files are not expected to reference a dmdSec
if (isset($this->fileInfos[$id]) || isset($hasMetadataSection['dmdSec'])) {
return $metadata;
} else {
$this->logger->warning('No supported metadata found for logical structure with @ID "' . $id . '"');
$this->logger->warning('No supported descriptive metadata found for logical structure with @ID "' . $id . '"');
return [];
}
}
Expand Down

0 comments on commit 9b425be

Please sign in to comment.