Make WordPress Core

Changeset 49113


Ignore:
Timestamp:
10/09/2020 03:51:34 PM (4 years ago)
Author:
SergeyBiryukov
Message:

Accessibility: Widgets: Add a "Cancel" link when editing a widget in accessibility mode.

This allows the user to go back without saving any changes to the widget.

Props garrett-eclipse, audrasjb, afercia.
Fixes #49354.

Location:
trunk/src/wp-admin
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/wp-admin/includes/widgets.php

    r48109 r49113  
    295295            <button type="button" class="button-link button-link-delete widget-control-remove"><?php _e( 'Delete' ); ?></button>
    296296            <span class="widget-control-close-wrapper">
    297                 |
    298                 <button type="button" class="button-link widget-control-close"><?php _e( 'Done' ); ?></button>
     297                | <button type="button" class="button-link widget-control-close"><?php _e( 'Done' ); ?></button>
    299298            </span>
    300299        </div>
  • trunk/src/wp-admin/widgets.php

    r47198 r49113  
    347347
    348348    <div class="widget-control-actions">
    349     <?php
    350     if ( isset( $_GET['addnew'] ) ) {
    351         ?>
    352     <a href="widgets.php" class="button alignleft"><?php _e( 'Cancel' ); ?></a>
    353         <?php
    354     } else {
    355         submit_button( __( 'Delete' ), 'alignleft', 'removewidget', false );
    356     }
    357     submit_button( __( 'Save Widget' ), 'primary alignright', 'savewidget', false );
    358     ?>
    359     <input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr( $widget_id ); ?>" />
    360     <input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr( $id_base ); ?>" />
    361     <input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr( $multi_number ); ?>" />
    362     <?php   wp_nonce_field( "save-delete-widget-$widget_id" ); ?>
    363     <br class="clear" />
    364     </div>
     349        <div class="alignleft">
     350            <?php if ( ! isset( $_GET['addnew'] ) ) : ?>
     351                <input type="submit" name="removewidget" id="removewidget" class="button-link button-link-delete widget-control-remove" value="<?php _e( 'Delete' ); ?>" />
     352                <span class="widget-control-close-wrapper">
     353                    | <a href="widgets.php" class="button-link widget-control-close"><?php _e( 'Cancel' ); ?></a>
     354                </span>
     355            <?php else : ?>
     356                <a href="widgets.php" class="button-link widget-control-close"><?php _e( 'Cancel' ); ?></a>
     357            <?php endif; ?>
     358        </div>
     359        <div class="alignright">
     360            <?php submit_button( __( 'Save Widget' ), 'primary alignright', 'savewidget', false ); ?>
     361            <input type="hidden" name="widget-id" class="widget-id" value="<?php echo esc_attr( $widget_id ); ?>" />
     362            <input type="hidden" name="id_base" class="id_base" value="<?php echo esc_attr( $id_base ); ?>" />
     363            <input type="hidden" name="multi_number" class="multi_number" value="<?php echo esc_attr( $multi_number ); ?>" />
     364            <?php wp_nonce_field( "save-delete-widget-$widget_id" ); ?>
     365        </div>
     366        <br class="clear" />
     367    </div>
     368
    365369    </form>
    366370    </div>
Note: See TracChangeset for help on using the changeset viewer.