Skip to content

Commit

Permalink
Contact Form: Fix Form submission showing extra colon (Automattic#28230)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcheringer authored Jan 9, 2023
1 parent 9337384 commit 16a66db
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 4 additions & 0 deletions projects/plugins/jetpack/changelog/y
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: bugfix

Fix extra colon for form fields without label
Original file line number Diff line number Diff line change
Expand Up @@ -2873,10 +2873,10 @@ public static function get_compiled_form( $feedback_id, $form ) {
$field = $form->fields[ $field_id ];
$field_index = array_search( $field_id, $field_ids['all'], true );

$label = $field->get_attribute( 'label' );
$label = $field->get_attribute( 'label' ) ? $field->get_attribute( 'label' ) . ':' : '';

$compiled_form[ $field_index ] = sprintf(
'<div class="field-name">%1$s:</div> <div class="field-value">%2$s</div>',
'<div class="field-name">%1$s</div> <div class="field-value">%2$s</div>',
wp_kses( $label, array() ),
self::escape_and_sanitize_field_value( $extra_fields[ $extra_field_keys[ $i ] ] )
);
Expand Down

0 comments on commit 16a66db

Please sign in to comment.