Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[BUGFIX] Change metadata to keep arrays instead of strings #1339

Merged
merged 3 commits into from
Sep 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 8 additions & 6 deletions Classes/Controller/MetadataController.php
Original file line number Diff line number Diff line change
Expand Up @@ -166,15 +166,17 @@ protected function printMetadata(array $metadata): void
// NOTE: Labels are to be escaped in Fluid template

$metadata[$i][$name] = is_array($value)
? implode($this->settings['separator'], $value)
: $value;
? $value
: explode($this->settings['separator'], $value);

if ($metadata[$i][$name] === 'Array') {
// PHPStan error
// I don't understand what this code does, so I take it away until author can fix it
/*if ($metadata[$i][$name][0] === 'Array') {
$metadata[$i][$name] = [];
foreach ($value as $subKey => $subValue) {
$metadata[$i][$name][$subKey] = $subValue;
}
}
}*/
sebastian-meyer marked this conversation as resolved.
Show resolved Hide resolved

$this->parseMetadata($i, $name, $value, $metadata);

Expand Down Expand Up @@ -431,9 +433,9 @@ private function parseOwner(int $i, array &$metadata) : void
*/
private function parseType(int $i, array &$metadata) : void
{
$structure = $this->structureRepository->findOneByIndexName($metadata[$i]['type']);
$structure = $this->structureRepository->findOneByIndexName($metadata[$i]['type'][0]);
if ($structure) {
$metadata[$i]['type'] = $structure->getLabel();
$metadata[$i]['type'][0] = $structure->getLabel();
}
}

Expand Down