protected function FormatRowToXml::buildAttributes in Views OAI-PMH 8
Compose attribute to set
Parameters
$attribute_name: tag name. e.g "descriptionType"
$attribute_value: tag value. e.g "Abstract"
$value: tag composed value
Return value
array Current attribute to set
1 call to FormatRowToXml::buildAttributes()
- FormatRowToXml::transform in src/
Service/ FormatRowToXml.php - Transform views rows data to array composer for xml for this view row
File
- src/
Service/ FormatRowToXml.php, line 81
Class
Namespace
Drupal\views_oai_pmh\ServiceCode
protected function buildAttributes($attribute_name, $attribute_value, $value) {
$output = [];
if (is_array($attribute_value) && !array_key_exists('#', $value)) {
foreach ($attribute_value as $id_row => $val_row) {
if (is_numeric($id_row)) {
$output[' ' . $id_row]['@' . $attribute_name] = $val_row;
}
else {
$output[$id_row]['@' . $attribute_name] = $val_row;
}
}
}
else {
$output['@' . $attribute_name] = $attribute_value;
}
return $output;
}