diff --git a/src/Field/Traits/HtmlAttributes.php b/src/Field/Traits/HtmlAttributes.php index 4edae3b2c02f656c237cf54ffe603a227abdea65..e0fc3ba7c8ef909c133401d1e39c66b5f4430bbd 100644 --- a/src/Field/Traits/HtmlAttributes.php +++ b/src/Field/Traits/HtmlAttributes.php @@ -33,13 +33,13 @@ trait HtmlAttributes { * * @return array<string[]|string|bool> */ - final public function get_attributes( array $except = [ 'name' ] ): array { + final public function get_attributes( array $except = [ 'name', 'method', 'action' ] ): array { return array_filter( $this->attributes, - static function ( $key ) use ( $except ) { - return ! in_array( $key, $except, true ); + static function ( $attribute, $key ) use ( $except ) { + return ! in_array( $key, $except, true ) && ! empty( $attribute ); }, - ARRAY_FILTER_USE_KEY + ARRAY_FILTER_USE_BOTH ); }