Jelajahi Sumber

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

jqh 3 tahun lalu
induk
melakukan
dd3b2f36fc
1 mengubah file dengan 6 tambahan dan 5 penghapusan
  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()
+            )
+        );
     }
 
     /**