Explorar o código

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

jqh %!s(int64=3) %!d(string=hai) anos
pai
achega
dd3b2f36fc
Modificáronse 1 ficheiros con 6 adicións e 5 borrados
  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()
+            )
+        );
     }
 
     /**