Skip to content
Snippets Groups Projects
Commit b64fe418 authored by Demian Katz's avatar Demian Katz
Browse files

Merge branch 'release-2.3'

parents 80f1379f 87982c21
No related merge requests found
......@@ -772,56 +772,67 @@ class SolrMarc extends SolrDefault
}
}
// Normalize blank relationship indicator to 0:
$relationshipIndicator = $field->getIndicator('2');
if ($relationshipIndicator == ' ') {
$relationshipIndicator = '0';
}
// Assign notes based on the relationship type
switch ($value) {
case '780':
if (in_array($relationshipIndicator, range('0', '7'))) {
$value .= '_' . $relationshipIndicator;
}
break;
case '785':
if (in_array($relationshipIndicator, range('0', '8'))) {
$value .= '_' . $relationshipIndicator;
}
break;
}
// Get data for field
$tmp = $this->getFieldData($field, $value);
$tmp = $this->getFieldData($field);
if (is_array($tmp)) {
$retVal[] = $tmp;
}
}
}
}
if (empty($retVal)) {
$retVal = null;
return empty($retVal) ? null : $retVal;
}
/**
* Support method for getFieldData() -- factor the relationship indicator
* into the field number where relevant to generate a note to associate
* with a record link.
*
* @param File_MARC_Data_Field $field Field to examine
*
* @return string
*/
protected function getRecordLinkNote($field)
{
// Normalize blank relationship indicator to 0:
$relationshipIndicator = $field->getIndicator('2');
if ($relationshipIndicator == ' ') {
$relationshipIndicator = '0';
}
// Assign notes based on the relationship type
$value = $field->getTag();
switch ($value) {
case '780':
if (in_array($relationshipIndicator, range('0', '7'))) {
$value .= '_' . $relationshipIndicator;
}
break;
case '785':
if (in_array($relationshipIndicator, range('0', '8'))) {
$value .= '_' . $relationshipIndicator;
}
break;
}
return $retVal;
return 'note_' . $value;
}
/**
* Returns the array element for the 'getAllRecordLinks' method
*
* @param File_MARC_Data_Field $field Field to examine
* @param string $value Field name for use in label
*
* @return array|bool Array on success, boolean false if no
* valid link could be found in the data.
*/
protected function getFieldData($field, $value)
protected function getFieldData($field)
{
// Make sure that there is a t field to be displayed:
if ($title = $field->getSubfield('t')) {
$title = $title->getData();
} else {
return;
return false;
}
$linkTypeSetting = isset($this->mainConfig->Record->marc_links_link_types)
......@@ -883,9 +894,11 @@ class SolrMarc extends SolrDefault
}
}
// Make sure we have something to display:
return isset($link)
? array('title' => 'note_' . $value, 'value' => $title, 'link' => $link)
: false;
return !isset($link) ? false : array(
'title' => $this->getRecordLinkNote($field),
'value' => $title,
'link' => $link
);
}
/**
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment