Make WordPress Core

Ticket #51877: 51877.2.patch

File 51877.2.patch, 2.5 KB (added by sabernhardt, 3 years ago)

editing argument to aria-label in get_search_form() functions for 3 files, and updating searchform.php to give a fallback for child theme templates that might use label

  • src/wp-content/themes/twentytwenty/404.php

     
    2121                <?php
    2222                get_search_form(
    2323                        array(
    24                                 'label' => __( '404 not found', 'twentytwenty' ),
     24                                'aria_label' => __( '404 not found', 'twentytwenty' ),
    2525                        )
    2626                );
    2727                ?>
  • src/wp-content/themes/twentytwenty/index.php

     
    9898                        <?php
    9999                        get_search_form(
    100100                                array(
    101                                         'label' => __( 'search again', 'twentytwenty' ),
     101                                        'aria_label' => __( 'search again', 'twentytwenty' ),
    102102                                )
    103103                        );
    104104                        ?>
  • src/wp-content/themes/twentytwenty/searchform.php

     
    1717 */
    1818$twentytwenty_unique_id = twentytwenty_unique_id( 'search-form-' );
    1919
    20 $twentytwenty_aria_label = ! empty( $args['label'] ) ? 'aria-label="' . esc_attr( $args['label'] ) . '"' : '';
     20$twentytwenty_aria_label = ! empty( $args['aria_label'] ) ? 'aria-label="' . esc_attr( $args['aria_label'] ) . '"' : '';
     21// Backward compatibility, in case a child theme template uses a `label` argument
     22if ( empty( $twentytwenty_aria_label ) && ! empty( $args['label'] ) ) {
     23        $twentytwenty_aria_label = 'aria-label="' . esc_attr( $args['label'] ) . '"';
     24}
    2125?>
    2226<form role="search" <?php echo $twentytwenty_aria_label; // phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped -- Escaped above. ?> method="get" class="search-form" action="<?php echo esc_url( home_url( '/' ) ); ?>">
    2327        <label for="<?php echo esc_attr( $twentytwenty_unique_id ); ?>">
  • src/wp-content/themes/twentytwenty/template-parts/modal-search.php

     
    1717                        <?php
    1818                        get_search_form(
    1919                                array(
    20                                         'label' => __( 'Search for:', 'twentytwenty' ),
     20                                        'aria_label' => __( 'Search for:', 'twentytwenty' ),
    2121                                )
    2222                        );
    2323                        ?>