Make WordPress Core

Changeset 43099


Ignore:
Timestamp:
05/02/2018 02:47:23 AM (7 years ago)
Author:
SergeyBiryukov
Message:

Accessibility improvements for the Privacy Tools screen.

Props afercia.
Merges [42823] to the 4.9 branch.
See #43435.

Location:
branches/4.9
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/4.9

  • branches/4.9/src/wp-admin/privacy.php

    r43098 r43099  
    6161}
    6262
    63 // If a privacy policy page ID is available, make sure the page actually exists. If not, display a warning
     63// If a privacy policy page ID is available, make sure the page actually exists. If not, display an error.
    6464$privacy_policy_page_exists = false;
    6565$privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
     
    7272                'page_for_privacy_policy',
    7373                __( 'The currently selected privacy policy page does not exist. Please create or select new page.' ),
    74                 'warning'
     74                'error'
    7575            );
    7676        } else {
     
    9191}
    9292
    93 $title = __( 'Privacy Tools' );
    94 
    9593get_current_screen()->add_help_tab( array(
    9694    'id'      => 'privacy',
     
    108106?>
    109107<div class="wrap">
    110     <h1><?php echo esc_html( $title ); ?></h1>
     108    <h1><?php _e( 'Privacy Tools' ); ?></h1>
    111109    <?php settings_errors(); ?>
    112110
    113     <h2 class="title"><?php _e( 'Privacy policy page' ); ?></h2>
     111    <h2><?php _e( 'Privacy policy page' ); ?></h2>
     112
     113    <?php
     114    if ( $privacy_policy_page_exists ) {
     115        $edit_href = add_query_arg(
     116            array(
     117                'post'  => $privacy_policy_page_id,
     118                'action' => 'edit',
     119            ),
     120            admin_url( 'post.php' )
     121        );
     122        $view_href = get_permalink( $privacy_policy_page_id );
     123
     124        ?>
     125        <p><strong>
     126            <?php
     127            printf(
     128                __( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your privacy policy.' ),
     129                $edit_href,
     130                $view_href
     131            );
     132            ?>
     133        </strong></p>
     134        <?php
     135    }
     136    ?>
     137
    114138    <table class="form-table">
    115         <?php
    116 
    117         if ( $privacy_policy_page_exists ) {
    118             $edit_href = add_query_arg(
    119                 array(
    120                     'post'  => $privacy_policy_page_id,
    121                     'action' => 'edit',
    122                 ),
    123                 admin_url( 'post.php' )
    124             );
    125             $view_href = get_permalink( $privacy_policy_page_id );
    126 
    127             ?>
    128             <tr>
    129                 <th colspan="2">
    130                     <?php
    131                     printf(
    132                         __( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your privacy policy.' ),
    133                         $edit_href,
    134                         $view_href
    135                     );
    136                     ?>
    137                 </th>
    138             </tr>
    139             <?php
    140         }
    141 
    142         ?>
    143139        <tr>
    144140            <th scope="row">
    145             <?php
    146 
    147             if ( $privacy_policy_page_exists ) {
    148                 _e( 'Select another page for your privacy policy' );
    149             } else {
    150                 _e( 'Select an existing privacy policy page' );
    151             }
    152 
    153             ?>
     141                <label for="page_for_privacy_policy">
     142                    <?php
     143
     144                    if ( $privacy_policy_page_exists ) {
     145                        _e( 'Select another page for your privacy policy' );
     146                    } else {
     147                        _e( 'Select an existing privacy policy page' );
     148                    }
     149
     150                    ?>
     151                </label>
    154152            </th>
    155153            <td id="front-static-pages">
    156154                <form method="post" action="">
    157                     <?php wp_nonce_field( 'set-privacy-page' ); ?>
    158155                    <input type="hidden" name="action" value="set-privacy-page" />
    159                     <fieldset>
    160                         <legend class="screen-reader-text"><span><?php _e( 'Select your privacy policy page.' ); ?></span></legend>
    161                         <label for="page_for_privacy_policy">
    162                             <?php wp_dropdown_pages(
    163                                 array(
    164                                     'name'              => 'page_for_privacy_policy',
    165                                     'show_option_none'  => __( '&mdash; Select &mdash;' ),
    166                                     'option_none_value' => '0',
    167                                     'selected'          => $privacy_policy_page_id,
    168                                     'post_status'       => array( 'draft', 'publish' ),
    169                                 )
    170                             );
    171                             ?>
    172                         </label>
    173                     </fieldset>
    174                         <?php submit_button( __( 'Set Page' ) ); ?>
     156                    <?php
     157
     158                    wp_dropdown_pages(
     159                        array(
     160                            'name'              => 'page_for_privacy_policy',
     161                            'show_option_none'  => __( '&mdash; Select &mdash;' ),
     162                            'option_none_value' => '0',
     163                            'selected'          => $privacy_policy_page_id,
     164                            'post_status'       => array( 'draft', 'publish' ),
     165                        )
     166                    );
     167
     168                    wp_nonce_field( 'set-privacy-page' );
     169                    submit_button( __( 'Set Page' ), 'primary', 'submit', true, array( 'id' => 'set-page' ) );
     170
     171                    ?>
    175172                </form>
    176173            </td>
     
    185182                    <form method="post" action="">
    186183                        <input type="hidden" name="action" value="create-privacy-page" />
    187                         <?php wp_nonce_field( 'create-privacy-page' ); ?>
    188                         <?php submit_button( __( 'Create Page' ) ); ?>
     184                        <?php
     185
     186                        wp_nonce_field( 'create-privacy-page' );
     187                        submit_button( __( 'Create Page' ), 'primary', 'submit', true, array( 'id' => 'create-page' ) );
     188
     189                        ?>
    189190                    </form>
    190191                </td>
Note: See TracChangeset for help on using the changeset viewer.