소스 검색

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

jqh 3 년 전
부모
커밋
dd3b2f36fc
1개의 변경된 파일6개의 추가작업 그리고 5개의 파일을 삭제
  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()
+            )
+        );
     }
 
     /**