private function remote__data_formatter::refineSubValue
3.x remote__data_formatter.inc | private remote__data_formatter::refineSubValue($values, $subfields) |
Adjusts the items array to contain only the section/subsection desired.
The field settings can indicate a field with sub fields that should be displayed (e.g. organism,genus or relationship,clause). We want to adjust the item to only include what the user requested.
Parameters
$values:
$subfields:
1 call to remote__data_formatter::refineSubValue()
- remote__data_formatter::view in tripal_ws/
includes/ TripalFields/ remote__data/ remote__data_formatter.inc - Provides the display for a field
File
- tripal_ws/
includes/ TripalFields/ remote__data/ remote__data_formatter.inc, line 206
Class
Code
private function refineSubValue($values, $subfields) {
// Remove unwanted elements.
unset($values['@id']);
unset($values['@context']);
unset($values['@type']);
unset($values['remote_entity']);
$subfield = array_shift($subfields);
if (array_key_exists($subfield, $values)) {
if (is_array($values[$subfield]) and count($subfields) > 0) {
return $this->refineSubvalue($values[$subfield], $subfields);
}
else {
return $values[$subfield];
}
}
else {
return $values;
}
}