You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -140,6 +141,7 @@ public function attr(Environment $env, ...$args): string
140
141
}
141
142
142
143
namespace {
144
+
useTwig\Environment;
143
145
useTwig\Error\RuntimeError;
144
146
145
147
functiontwig_html_classes(...$args): string
@@ -165,4 +167,75 @@ function twig_html_classes(...$args): string
165
167
166
168
returnimplode('', array_unique($classes));
167
169
}
170
+
171
+
functiontwig_attr_merge(...$arrays): array
172
+
{
173
+
$result = [];
174
+
175
+
foreach ($arraysas$argNumber => $array) {
176
+
if (!$array) {
177
+
continue;
178
+
}
179
+
180
+
if (!twig_test_iterable($array)) {
181
+
thrownewRuntimeError(sprintf('The attr_merge filter only works with arrays or "Traversable", got "%s" for argument %d.', \gettype($array), $argNumber + 1));
0 commit comments