Skip to content

Commit dadd3fb

Browse files
committed
Add attributes support to Form class
1 parent 1e0057c commit dadd3fb

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

core/form/Form.php

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,13 @@
1818
*/
1919
class Form
2020
{
21-
public static function begin($action, $method)
21+
public static function begin($action, $method, $options = [])
2222
{
23-
echo sprintf('<form action="%s" method="%s">', $action, $method);
23+
$attributes = [];
24+
foreach ($options as $key => $value) {
25+
$attributes[] = "$key=\"$value\"";
26+
}
27+
echo sprintf('<form action="%s" method="%s" %s>', $action, $method, implode(" ", $attributes));
2428
return new Form();
2529
}
2630

0 commit comments

Comments
 (0)