Skip to content

Commit 33af3d3

Browse files
authored
Allow objects or arrays as extra attributes
1 parent 8350b35 commit 33af3d3

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/AttributeManager.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -96,6 +96,11 @@ public function getExtraAttributes(View $view)
9696
return null;
9797
}
9898

99+
// ['data-something' => ['an', 'array']]
100+
if (is_object($value) || is_array($value)) {
101+
$value = json_encode($value);
102+
}
103+
99104
return sprintf('%s="%s"', $key, htmlspecialchars($value));
100105
}, array_keys($extra), $extra);
101106

0 commit comments

Comments
 (0)