WordPress.org

Make WordPress Core

Changeset 50933


Ignore:
Timestamp:
05/19/2021 06:38:53 PM (4 months ago)
Author:
davidbaumwald
Message:

Twenty Twenty: Correct label attribute references to aria_label in get_search_form.

In the bundled Twenty Twenty theme, a label argument was passed to get_search_form but used as the aria_label on the form. This change updates the argument name to aria_label and maintains backwards compatibility for usage of the original label argument.

Props poena, sabernhardt, ipulc2, kishanjasani, mukesh27.
Fixes #51877.

Location:
trunk/src/wp-content/themes/twentytwenty
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-content/themes/twentytwenty/404.php

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

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

    r47393 r50933  
    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( '/' ) ); ?>">
  • trunk/src/wp-content/themes/twentytwenty/template-parts/modal-search.php

    r50033 r50933  
    1818            get_search_form(
    1919                array(
    20                     'label' => __( 'Search for:', 'twentytwenty' ),
     20                    'aria_label' => __( 'Search for:', 'twentytwenty' ),
    2121                )
    2222            );
Note: See TracChangeset for help on using the changeset viewer.