Skip to content

Commit ebb4d63

Browse files
committed
Fixed nested value naming
1 parent fa75521 commit ebb4d63

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

src/Elements/Element.php

+7-1
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,13 @@ public function getInputName($default = null) : ?string
101101
return null;
102102
}
103103

104-
return rtrim($name, '[]');
104+
// Trim [] off non-associative array values
105+
if ('[]' === substr($name, -2)) {
106+
$name = substr($name, 0, -2);
107+
}
108+
109+
// Then convert foo[bar][baz] to foo.bar.baz
110+
return preg_replace('/\[([^\]]+)\]/m', '.$1', $name);
105111
}
106112

107113
public function setAttribute($key, $value) : self

0 commit comments

Comments
 (0)