Browse Source

删除无效配置

xaboy 6 years ago
parent
commit
8b93b84921
3 changed files with 20 additions and 42 deletions
  1. 16 38
      src/Form.php
  2. 2 2
      src/UI/Elm/Config.php
  3. 2 2
      src/UI/Iview/Config.php

+ 16 - 38
src/Form.php

@@ -21,8 +21,6 @@ use FormBuilder\UI\Elm\Bootstrap as ElmBootstrap;
 
 class Form
 {
-    protected $loadScript = true;
-
     protected $headers = [];
 
     protected $formContentType = 'application/x-www-form-urlencoded';
@@ -166,16 +164,6 @@ class Form
     }
 
     /**
-     * @param bool $load
-     * @return $this
-     */
-    public function loadScript($load)
-    {
-        $this->loadScript = !!$load;
-        return $this;
-    }
-
-    /**
      * @param array $rule
      * @return $this
      * @throws FormBuilderException
@@ -245,42 +233,32 @@ class Form
     }
 
     /**
-     * 隐藏表单提交按钮
-     * @return $this
-     */
-    public function hideSubmitBtn()
-    {
-        $this->config['submitBtn'] = false;
-        return $this;
-    }
-
-    /**
-     * 显示表单提交按钮
-     * @return $this
-     */
-    public function showSubmitBtn()
-    {
-        $this->config['submitBtn'] = true;
-        return $this;
-    }
-
-    /**
-     * 隐藏表单重置按钮
+     * 提交按钮显示状态
+     *
+     * @param $isShow
      * @return $this
      */
-    public function hideResetBtn()
+    public function showSubmitBtn($isShow)
     {
-        $this->config['resetBtn'] = false;
+        if ($this->config instanceof ConfigInterface)
+            $this->config->submitBtn(!!$isShow);
+        else
+            $this->config['submitBtn'] = !!$isShow;
         return $this;
     }
 
     /**
-     * 显示表单重置按钮
+     * 重置按钮显示状态
+     *
+     * @param $isShow
      * @return $this
      */
-    public function showResetBtn()
+    public function showResetBtn($isShow)
     {
-        $this->config['resetBtn'] = true;
+        if ($this->config instanceof ConfigInterface)
+            $this->config->resetBtn(!!$isShow);
+        else
+            $this->config['resetBtn'] = !!$isShow;
         return $this;
     }
 

+ 2 - 2
src/UI/Elm/Config.php

@@ -95,7 +95,7 @@ class Config implements ConfigInterface
     /**
      * 提交按钮样式和布局配置
      *
-     * @param Button|array $btn
+     * @param Button|array|bool $btn
      * @return $this
      */
     public function submitBtn($btn)
@@ -126,7 +126,7 @@ class Config implements ConfigInterface
     /**
      * 重置按钮样式和布局配置
      *
-     * @param Button|array $btn
+     * @param Button|array|bool $btn
      * @return $this
      */
     public function resetBtn($btn)

+ 2 - 2
src/UI/Iview/Config.php

@@ -95,7 +95,7 @@ class Config implements ConfigInterface
     /**
      * 提交按钮样式和布局配置
      *
-     * @param Button|array $btn
+     * @param Button|array|bool $btn
      * @return $this
      */
     public function submitBtn($btn)
@@ -126,7 +126,7 @@ class Config implements ConfigInterface
     /**
      * 重置按钮样式和布局配置
      *
-     * @param Button|array $btn
+     * @param Button|array|bool $btn
      * @return $this
      */
     public function resetBtn($btn)