| @@ -68,11 +68,8 @@ | ||
| 68 | 68 | } |
| 69 | 69 | if ( ! empty( $typography_classes ) ) { |
| 70 | 70 | $input_classes[] = $typography_classes; |
| 71 | 71 | } |
| 72 | - if ( ! $show_button && ! empty( $color_classes ) ) { | |
| 73 | - $input_classes[] = $color_classes; | |
| 74 | - } | |
| 75 | 72 | if ( $input->next_tag() ) { |
| 76 | 73 | $input->add_class( implode( ' ', $input_classes ) ); |
| 77 | 74 | $input->set_attribute( 'id', $input_id ); |
| 78 | 75 | $input->set_attribute( 'value', get_search_query( false ) ); |
| @@ -190,34 +187,10 @@ | ||
| 190 | 187 | data-wp-on--focusout="actions.handleSearchFocusout" |
| 191 | 188 | '; |
| 192 | 189 | } |
| 193 | 190 | |
| 194 | - /* | |
| 195 | - * The semantic <search> landmark wrapper is opt-in to preserve back | |
| 196 | - * compatibility with themes targeting <form role="search">. The block | |
| 197 | - * exposes a per-instance HTML element selector with three values: | |
| 198 | - * | |
| 199 | - * - 'search' forces the <search> wrapper | |
| 200 | - * - 'form' forces the original <form role="search"> markup | |
| 201 | - * - empty defers to the 'search-element' html5 sub-feature | |
| 202 | - * ( add_theme_support( 'html5', array( 'search-element' ) ) ), | |
| 203 | - * matching the opt-in added to get_search_form() in core | |
| 204 | - */ | |
| 205 | - $tag_name = $attributes['tagName'] ?? ''; | |
| 206 | - $use_search_element = 'search' === $tag_name || ( '' === $tag_name && current_theme_supports( 'html5', 'search-element' ) ); | |
| 207 | - | |
| 208 | - /* | |
| 209 | - * Only the wrapper markup differs between the semantic <search> landmark | |
| 210 | - * and the classic <form role="search">. Positional specifiers keep a | |
| 211 | - * single argument list usable by both formats, since the action URL | |
| 212 | - * precedes the wrapper attributes in the <search> variant. | |
| 213 | - */ | |
| 214 | - $format = $use_search_element | |
| 215 | - ? '<search %2$s %3$s><form method="get" action="%1$s">%4$s</form></search>' | |
| 216 | - : '<form role="search" method="get" action="%1$s" %2$s %3$s>%4$s</form>'; | |
| 217 | - | |
| 218 | 191 | return sprintf( |
| 219 | - $format, | |
| 192 | + '<form role="search" method="get" action="%1s" %2s %3s>%4s</form>', | |
| 220 | 193 | esc_url( home_url( '/' ) ), |
| 221 | 194 | $wrapper_attributes, |
| 222 | 195 | $form_directives, |
| 223 | 196 | $label . $field_markup |
| @@ -456,39 +429,22 @@ | ||
| 456 | 429 | } |
| 457 | 430 | } |
| 458 | 431 | } |
| 459 | 432 | |
| 460 | - $use_input_for_colors = ! empty( $attributes['buttonPosition'] ) && 'no-button' === $attributes['buttonPosition']; | |
| 461 | - | |
| 462 | 433 | // Add color styles. |
| 463 | 434 | $has_text_color = ! empty( $attributes['style']['color']['text'] ); |
| 464 | 435 | if ( $has_text_color ) { |
| 465 | - $text_color_style = sprintf( 'color: %s;', $attributes['style']['color']['text'] ); | |
| 466 | - if ( $use_input_for_colors ) { | |
| 467 | - $input_styles[] = $text_color_style; | |
| 468 | - } else { | |
| 469 | - $button_styles[] = $text_color_style; | |
| 470 | - } | |
| 436 | + $button_styles[] = sprintf( 'color: %s;', $attributes['style']['color']['text'] ); | |
| 471 | 437 | } |
| 472 | 438 | |
| 473 | 439 | $has_background_color = ! empty( $attributes['style']['color']['background'] ); |
| 474 | 440 | if ( $has_background_color ) { |
| 475 | - $background_color_style = sprintf( 'background-color: %s;', $attributes['style']['color']['background'] ); | |
| 476 | - if ( $use_input_for_colors ) { | |
| 477 | - $input_styles[] = $background_color_style; | |
| 478 | - } else { | |
| 479 | - $button_styles[] = $background_color_style; | |
| 480 | - } | |
| 441 | + $button_styles[] = sprintf( 'background-color: %s;', $attributes['style']['color']['background'] ); | |
| 481 | 442 | } |
| 482 | 443 | |
| 483 | 444 | $has_custom_gradient = ! empty( $attributes['style']['color']['gradient'] ); |
| 484 | 445 | if ( $has_custom_gradient ) { |
| 485 | - $custom_gradient_style = sprintf( 'background: %s;', $attributes['style']['color']['gradient'] ); | |
| 486 | - if ( $use_input_for_colors ) { | |
| 487 | - $input_styles[] = $custom_gradient_style; | |
| 488 | - } else { | |
| 489 | - $button_styles[] = $custom_gradient_style; | |
| 490 | - } | |
| 446 | + $button_styles[] = sprintf( 'background: %s;', $attributes['style']['color']['gradient'] ); | |
| 491 | 447 | } |
| 492 | 448 | |
| 493 | 449 | // Get typography styles to be shared across inner elements. |
| 494 | 450 | $typography_styles = esc_attr( get_typography_gutenberg_styles_for_block_core_search( $attributes ) ); |