Browse Source

修复设置表单字段class会覆盖默认class问题

jqh 3 years ago
parent
commit
dd3b2f36fc
1 changed files with 6 additions and 5 deletions
  1. 6 5
      src/Form/Field.php

+ 6 - 5
src/Form/Field.php

@@ -967,11 +967,12 @@ class Field implements Renderable
      */
     public function getElementClass()
     {
-        if (! $this->elementClass) {
-            $this->elementClass = $this->getDefaultElementClass();
-        }
-
-        return $this->elementClass;
+        return array_values(
+            array_unique(
+                $this->elementClass,
+                $this->getDefaultElementClass()
+            )
+        );
     }
 
     /**