Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions src/RecordManager/Base/Record/AbstractRecord.php
Original file line number Diff line number Diff line change
Expand Up @@ -596,4 +596,17 @@ protected function validateDate($dateString)
}
return '';
}

/**
* Create data from values obtained from a component part.
* Each record format handles component parts differently.
*
* @param array $data Component part data
*
* @return array Array containing values to merge
*/
protected function createComponentPartEntry(array $data): array
{
return [];
}
}
28 changes: 28 additions & 0 deletions src/RecordManager/Base/Record/Marc.php
Original file line number Diff line number Diff line change
Expand Up @@ -1692,6 +1692,34 @@ protected function getBuildingFieldSpec(): array
return $buildingFields;
}

/**
* Create data from a component values.
* Returns component part as a field for Marc.
*
* @param array $data Component part data
*
* @return array Array containing values to merge
*/
protected function createComponentPartEntry(array $data): array
{
$newField = [
'subfields' => [
['a' => $data['_id']],
],
];
if ($data['title']) {
$newField['subfields'][] = ['b' => $data['title']];
}
if ($data['authors']) {
$newField['subfields'][] = ['c' => array_shift($data['authors'])];
foreach ($data['authors'] as $author) {
$newField['subfields'][] = ['d' => $author];
}
}

return $newField;
}

/**
* Get alternate titles
*
Expand Down