Closed beatrycze-volk closed 3 weeks ago
To correct the error, the line
$structure = $this->structureRepository->findOneByIndexName($metadata[$i]['type'][0]);
must be changed to
$structure = $this->structureRepository->findOneByIndexName($metadata[$i]['type']);
and the line $metadata[$i]['type'][0] = $structure->getLabel();
as well, see #1316
Actually the correction should happen in this line:
$metadata[$i][$name] = is_array($value) ? implode($this->settings['separator'], $value) : $value;
Because it is totally normal to get here array of values. It is even expected as we need to iterate over for e.g collections (it is totally ok that document belongs to many collections and then they need to be retrieved from database) or languages The implosion happens in buildMetaConfigObjectData()
function which takes as argument$metadata
array
.
Example:
private function parseCollections(int $i, $value, array &$metadata) : void
{
$j = 0;
foreach ($value as $entry) {
$collection = $this->collectionRepository->findOneByIndexName($entry);
if ($collection) {
$metadata[$i]['collection'][$j] = $collection->getLabel() ? : '';
$j++;
}
}
}
Actually this part is now also broken, I just didn't make a ticket yet for it.
If I see this correctly all of this was introduced with the two-level metadata feature. So I again tag @chrizzor to please fix this.
Description
Structure types are currently not translated. Instead of it the index name of structure is displayed. It is caused by explicit casting value of metadata from
array
tostring
. ThenparseType()
tries to retrieve from database the translation for the first element ofarray
. But after cast the actual first element ofarray
is the letter 'i' instead of the word 'issue'.Code:
Expected Behavior
Structure types should be translated and displayed translated in metadata plugin (
MetadataController
).Screenshots and Examples
Additional Context
Related to #1308