xaboy 6 年 前
コミット
fd55344c72
1 ファイル変更10 行追加0 行削除
  1. 10 0
      src/FormHandle.php

+ 10 - 0
src/FormHandle.php

@@ -37,6 +37,8 @@ abstract class FormHandle implements FormHandleInterface
 
 
     protected $except = [];
     protected $except = [];
 
 
+    protected $scene;
+
     /**
     /**
      * 表单 UI
      * 表单 UI
      *
      *
@@ -53,6 +55,11 @@ abstract class FormHandle implements FormHandleInterface
         return [];
         return [];
     }
     }
 
 
+    public function scene()
+    {
+        return $this->scene;
+    }
+
     /**
     /**
      * 获取表单配置
      * 获取表单配置
      *
      *
@@ -130,6 +137,9 @@ abstract class FormHandle implements FormHandleInterface
      */
      */
     public function form()
     public function form()
     {
     {
+        if ($this->scene && method_exists($this, $this->scene . 'Scene'))
+            $this->{$this->scene . 'Scene'}();
+
         $form = $this->createForm()->setMethod($this->method);
         $form = $this->createForm()->setMethod($this->method);
         if (!is_null($this->title)) $form->setTitle($this->title)->headers($this->headers);
         if (!is_null($this->title)) $form->setTitle($this->title)->headers($this->headers);
         $formData = $this->getFormData();
         $formData = $this->getFormData();