- WIP on forms and UI widgets

This commit is contained in:
Dave Mc Nicoll committed 2020-03-17 16:14:47 -04:00
1 parent 657ceb2863
commit b1129def47
7 files changed
+31 -18

No files matched your search

+4 -2
View File
@@ -47,10 +47,11 @@ class UiForm extends UiElement implements Extension {
}
$method ??= $this->defaultMethod;
return "<?php echo ( new \\" . static::class . "() )->buildHtml('$method', $arguments) ?>";
}
public function buildHtml(string $method = "get", string $action = "", array $attributes = []) : string
public function buildHtml(string $method = "get", string $name = "", string $action = "", array $attributes = []) : string
{
$method = strtolower($method);
@@ -59,7 +60,8 @@ class UiForm extends UiElement implements Extension {
$this->attributes([ 'method' => $method, 'action' => $action ] + $attributes);
if ( $method !== "get" ) {
$this->append( ( new UiHidden() )->attributes([ 'name' =>"picea-csrf-protection", 'value' => "abcdefg" ]) );
$this->append( ( new UiHidden() )->attributes([ 'name' =>"picea-ui-form[$name]", 'value' => md5( $name . microtime() ) ]) );
$this->attributes([ 'enctype' => "multipart/form-data" ]);
}