Skip to content

Commit

Permalink
Fix entry type overriding
Browse files Browse the repository at this point in the history
  • Loading branch information
zozlak committed Feb 18, 2022
1 parent caf021f commit 2fd8db5
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/acdhOeaw/arche/biblatex/Resource.php
Original file line number Diff line number Diff line change
Expand Up @@ -151,15 +151,18 @@ private function applyOverrides(array &$fields, ?string $override = null): void
throw new RuntimeException("Exactly one BibLaTeX entry expected but " . count($entries) . " parsed: $biblatex");
}
foreach ($entries[0] as $key => $value) {
if (!in_array($key, ['type', '_type', '_original', 'citation-key'])) {
if (!in_array($key, ['_type', '_original', 'citation-key', 'type'])) {
$fields[$key] = $value;
$this->log?->debug("Overwriting field '$key' with '$value'");
} elseif ($key === 'type' && $value !== self::NO_OVERRIDE) {
} elseif ($key === '_type' && $value !== self::NO_OVERRIDE) {
$this->mapping->type = $value;
$this->log?->debug("Overwriting entry type with '$value'");
} elseif ($key === 'citation-key' && $value !== self::NO_OVERRIDE) {
$this->config->mapping->key = $value;
$this->log?->debug("Overwriting citation key with '$value'");
} elseif ($key === 'type' and $value !== ($entries[0]['_type'] ?? '')) {
$fields[$key] = $value;
$this->log?->debug("Overwriting field '$key' with '$value'");
}
}
} catch (BiblatexE1 $e) {
Expand Down

0 comments on commit 2fd8db5

Please sign in to comment.