Skip to content

Commit

Permalink
Search block: remove double spaces (#41746)
Browse files Browse the repository at this point in the history
* Search block: remove double spaces

* remove var_dump

* lint fix
  • Loading branch information
scruffian authored Jun 15, 2022
1 parent 18a88ce commit cc6ed98
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions packages/block-library/src/search/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,20 +80,23 @@ function render_block_core_search( $attributes ) {
}

if ( $show_button ) {
$button_classes = array();
$button_internal_markup = '';
$button_classes = $color_classes;
$aria_label = '';
if ( ! empty( $color_classes ) ) {
$button_classes[] = $color_classes;
}
$aria_label = '';

if ( ! $is_button_inside ) {
$button_classes .= ' ' . $border_color_classes;
if ( ! $is_button_inside && ! empty( $border_color_classes ) ) {
$button_classes[] = $border_color_classes;
}
if ( ! $use_icon_button ) {
if ( ! empty( $attributes['buttonText'] ) ) {
$button_internal_markup = wp_kses_post( $attributes['buttonText'] );
}
} else {
$aria_label = sprintf( 'aria-label="%s"', esc_attr( wp_strip_all_tags( $attributes['buttonText'] ) ) );
$button_classes .= ' has-icon';
$aria_label = sprintf( 'aria-label="%s"', esc_attr( wp_strip_all_tags( $attributes['buttonText'] ) ) );
$button_classes[] = 'has-icon';

$button_internal_markup =
'<svg class="search-icon" viewBox="0 0 24 24" width="24" height="24">
Expand All @@ -102,11 +105,11 @@ function render_block_core_search( $attributes ) {
}

// Include the button element class.
$button_classes .= ' ' . WP_Theme_JSON_GUTENBERG::__EXPERIMENTAL_ELEMENT_BUTTON_CLASS_NAME;
$button_classes[] = WP_Theme_JSON_GUTENBERG::__EXPERIMENTAL_ELEMENT_BUTTON_CLASS_NAME;

$button_markup = sprintf(
'<button type="submit" class="wp-block-search__button %s" %s %s>%s</button>',
esc_attr( $button_classes ),
esc_attr( implode( ' ', $button_classes ) ),
$inline_styles['button'],
$aria_label,
$button_internal_markup
Expand Down

0 comments on commit cc6ed98

Please sign in to comment.