jqh 5 年之前
父节点
当前提交
aefe40e59e
共有 2 个文件被更改,包括 12 次插入3 次删除
  1. 4 0
      src/Form/BlockForm.php
  2. 8 3
      src/Widgets/Form.php

+ 4 - 0
src/Form/BlockForm.php

@@ -76,6 +76,10 @@ class BlockForm extends WidgetForm
 HTML;
     }
 
+    public function fillFields(array $data)
+    {
+    }
+
     protected function renderHeader()
     {
         if (! $this->title) {

+ 8 - 3
src/Widgets/Form.php

@@ -470,9 +470,7 @@ class Form implements Renderable
     {
         $this->setHtmlAttribute('id', $this->getElementId());
 
-        foreach ($this->fields as $field) {
-            $field->fill($this->model()->toArray());
-        }
+        $this->fillFields($this->model()->toArray());
 
         return [
             'start'   => $this->open(),
@@ -483,6 +481,13 @@ class Form implements Renderable
         ];
     }
 
+    public function fillFields(array $data)
+    {
+        foreach ($this->fields as $field) {
+            $field->fill($data);
+        }
+    }
+
     /**
      * @return string
      */