Skip to content
Snippets Groups Projects
Verified Commit 08b0068a authored by Bartek Jaskulski's avatar Bartek Jaskulski
Browse files

fix: prevent all empty attributes from being written to templates

parent dc8237b4
No related branches found
No related tags found
3 merge requests!28release: 3.0.0,!23Feature/strong typing pp,!19Add strong typing for 3.0 version
Pipeline #6455 passed
......@@ -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
);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment