From 907581422fd0c1b5b3f32f049352e66bfff73185 Mon Sep 17 00:00:00 2001 From: dannylamb Date: Tue, 31 Mar 2020 11:27:28 -0300 Subject: [PATCH] wrapping string in array for case where there's no rdf mapping --- src/Plugin/ContextReaction/JsonldTypeAlterReaction.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Plugin/ContextReaction/JsonldTypeAlterReaction.php b/src/Plugin/ContextReaction/JsonldTypeAlterReaction.php index ae4bc55a..b2e757ff 100644 --- a/src/Plugin/ContextReaction/JsonldTypeAlterReaction.php +++ b/src/Plugin/ContextReaction/JsonldTypeAlterReaction.php @@ -44,6 +44,9 @@ class JsonldTypeAlterReaction extends NormalizerAlterReaction { // Search for the entity in the graph. foreach ($normalized['@graph'] as &$elem) { + if (!is_array($elem['@type'])) { + $elem['@type'] = [$elem['@type']]; + } if ($elem['@id'] === $this->getSubjectUrl($entity)) { foreach ($entity->get($config['source_field'])->getValue() as $type) { // If the configured field is using an entity reference,