Skip to content

Commit

Permalink
[FINNA-1246-1248] Add subfields & make first char uppercase for Uncon…
Browse files Browse the repository at this point in the history
…trolled Title in Record View
  • Loading branch information
tmikkonen committed Feb 22, 2024
1 parent 5113609 commit f4ac258
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions module/Finna/src/Finna/RecordDriver/SolrMarc.php
Original file line number Diff line number Diff line change
Expand Up @@ -2376,20 +2376,21 @@ public function getLanguageNotes()
}

/**
* Get uncontrolled title from field 740, subfield a.
* Get uncontrolled title from field 740, subfields a, n and p.
*
* @return array
*/
public function getUncontrolledTitle()
{
$results = [];
foreach ($this->getMarcReader()->getFields('740') as $field) {
if ($subfield = $this->getSubfield($field, 'a')) {
foreach ($this->getSubfieldArray($field, ['a', 'n', 'p'], false) as $subfield) {
$subfield = $this->stripTrailingPunctuation($subfield);
if (($ind1 = $field['i1']) && ctype_digit($ind1)) {
$results[] = substr($subfield, $ind1);
$substr = substr($subfield, $ind1);
$results[] = mb_convert_case(mb_substr($substr, 0, 1), MB_CASE_TITLE) . mb_substr($substr, 1);
} else {
$results[] = $this->stripTrailingPunctuation($subfield);
$results[] = $subfield;
}
}
}
Expand Down

0 comments on commit f4ac258

Please sign in to comment.