public function FormatRowToXml::transform in Views OAI-PMH 8
Transform views rows data to array composer for xml for this view row
Parameters
array $row: view row data
Return value
array array ready to convert to xml
File
- src/
Service/ FormatRowToXml.php, line 108
Class
Namespace
Drupal\views_oai_pmh\ServiceCode
public function transform(array $row) : array {
$values = [];
$output = [];
foreach ($row as $alias => $value) {
if ($attribute = $this
->hasAttribute($alias)) {
$tag_name = $attribute[0];
$tag_attr_name = $attribute[1];
$current_value = $this
->buildAttributes($tag_attr_name, $value, $values[$tag_name]);
$alias = $tag_name;
}
else {
$tag_name = $alias;
$current_value = $this
->buildValues($value);
}
$values[$tag_name] = $current_value;
$output = array_merge_recursive($output, $this
->depth($alias, $current_value));
}
$output = array_map(array(
$this,
"trimmingKeys",
), $output);
return $output;
}