Skip to content

Commit 0f3b4e5

Browse files
authored
Remove attribute if it has no value and readd it with a null value, fixes #108 (#115)
1 parent 7189c05 commit 0f3b4e5

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

classes/class-cpt-wplf-form.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -939,11 +939,19 @@ public function shortcode( $shortcode_atts, $content = null ) {
939939
// we don't render id and class as <form> attributes
940940
$id = $attributes['id'];
941941
$xclass = $attributes['xclass'];
942+
942943
$attributes = array_diff_key( $shortcode_atts, array(
943944
'id' => null,
944945
'xclass' => null,
945946
) );
946947

948+
foreach ( $attributes as $k => $v ) {
949+
if ( is_numeric( $k ) ) {
950+
unset( $attributes[ $k ] );
951+
$attributes[ $v ] = null; // empty value
952+
}
953+
}
954+
947955
// display form
948956
return $this->wplf_form( $id, $content, $xclass, $attributes );
949957
}

0 commit comments

Comments
 (0)