Skip to content

Commit 121609a

Browse files
nbaosullivanfubhy
authored andcommitted
Certain attributes like class can be arrays. Check for that and implode them. (#913)
1 parent c036782 commit 121609a

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

src/Plugin/GraphQL/DataProducer/Menu/MenuLink/MenuLinkAttribute.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,13 @@ class MenuLinkAttribute extends DataProducerPluginBase {
3636
*/
3737
public function resolve(MenuLinkInterface $link, $attribute) {
3838
$options = $link->getOptions();
39-
return NestedArray::getValue($options, ['attributes', $attribute]);
39+
// Certain attributes like class can be arrays. Check for that and implode them.
40+
$attributeValue = NestedArray::getValue($options, ['attributes', $attribute]);
41+
if (is_array($attributeValue)) {
42+
return implode(" ", $attributeValue);
43+
} else {
44+
return $attributeValue;
45+
}
4046
}
4147

4248
}

0 commit comments

Comments
 (0)