$input_id =
wp_unique_id( 'wp-block-search__input-'
);
$classnames =
classnames_for_block_core_search( $attributes );
$show_label =
( !
empty( $attributes['showLabel'
] ) ) ? true : false;
$use_icon_button =
( !
empty( $attributes['buttonUseIcon'
] ) ) ? true : false;
$show_button =
( !
empty( $attributes['buttonPosition'
] ) && 'no-button' ===
$attributes['buttonPosition'
] ) ? false : true;
$button_position =
$show_button ?
$attributes['buttonPosition'
] : null;
$query_params =
( !
empty( $attributes['query'
] ) ) ?
$attributes['query'
] : array
();
$button_behavior =
( !
empty( $attributes['buttonBehavior'
] ) ) ?
$attributes['buttonBehavior'
] : 'default';
$button = '';
$query_params_markup = '';
$inline_styles =
styles_for_block_core_search( $attributes );
$color_classes =
get_color_classes_for_block_core_search( $attributes );
$typography_classes =
get_typography_classes_for_block_core_search( $attributes );
$is_button_inside = !
empty( $attributes['buttonPosition'
] ) &&
'button-inside' ===
$attributes['buttonPosition'
];
// Border color classes need to be applied to the elements that have a border color.
$border_color_classes =
get_border_color_classes_for_block_core_search( $attributes );
$label_inner_html =
empty( $attributes['label'
] ) ?
__( 'Search'
) :
wp_kses_post( $attributes['label'
] );
$label =
new WP_HTML_Tag_Processor( sprintf( '<label %1$s>%2$s</label>',
$inline_styles['label'
],
$label_inner_html ) );
if ( $label->
next_tag() ) { $label->
set_attribute( 'for',
$input_id );