Accessibility improvements for the Privacy Tools screen.

Props afercia.
Merges [42823] to the 4.9 branch.
See #43435.
Built from https://develop.svn.wordpress.org/branches/4.9@43099


git-svn-id: http://core.svn.wordpress.org/branches/4.9@42928 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2018-05-02 02:48:26 +00:00
parent 9af2f7cd35
commit 1b0bd1ff7a
2 changed files with 60 additions and 59 deletions

View File

@ -60,7 +60,7 @@ if ( ! empty( $action ) ) {
} }
} }
// If a privacy policy page ID is available, make sure the page actually exists. If not, display a warning // If a privacy policy page ID is available, make sure the page actually exists. If not, display an error.
$privacy_policy_page_exists = false; $privacy_policy_page_exists = false;
$privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' ); $privacy_policy_page_id = (int) get_option( 'wp_page_for_privacy_policy' );
@ -71,7 +71,7 @@ if ( ! empty( $privacy_policy_page_id ) ) {
'page_for_privacy_policy', 'page_for_privacy_policy',
'page_for_privacy_policy', 'page_for_privacy_policy',
__( 'The currently selected privacy policy page does not exist. Please create or select new page.' ), __( 'The currently selected privacy policy page does not exist. Please create or select new page.' ),
'warning' 'error'
); );
} else { } else {
if ( 'trash' === $privacy_policy_page->post_status ) { if ( 'trash' === $privacy_policy_page->post_status ) {
@ -90,8 +90,6 @@ if ( ! empty( $privacy_policy_page_id ) ) {
} }
} }
$title = __( 'Privacy Tools' );
get_current_screen()->add_help_tab( array( get_current_screen()->add_help_tab( array(
'id' => 'privacy', 'id' => 'privacy',
'title' => __( 'Privacy' ), 'title' => __( 'Privacy' ),
@ -107,13 +105,12 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
?> ?>
<div class="wrap"> <div class="wrap">
<h1><?php echo esc_html( $title ); ?></h1> <h1><?php _e( 'Privacy Tools' ); ?></h1>
<?php settings_errors(); ?> <?php settings_errors(); ?>
<h2 class="title"><?php _e( 'Privacy policy page' ); ?></h2> <h2><?php _e( 'Privacy policy page' ); ?></h2>
<table class="form-table">
<?php
<?php
if ( $privacy_policy_page_exists ) { if ( $privacy_policy_page_exists ) {
$edit_href = add_query_arg( $edit_href = add_query_arg(
array( array(
@ -125,8 +122,7 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
$view_href = get_permalink( $privacy_policy_page_id ); $view_href = get_permalink( $privacy_policy_page_id );
?> ?>
<tr> <p><strong>
<th colspan="2">
<?php <?php
printf( printf(
__( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your privacy policy.' ), __( '<a href="%1$s">Edit</a> or <a href="%2$s">view</a> your privacy policy.' ),
@ -134,14 +130,15 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
$view_href $view_href
); );
?> ?>
</th> </strong></p>
</tr>
<?php <?php
} }
?> ?>
<table class="form-table">
<tr> <tr>
<th scope="row"> <th scope="row">
<label for="page_for_privacy_policy">
<?php <?php
if ( $privacy_policy_page_exists ) { if ( $privacy_policy_page_exists ) {
@ -151,15 +148,14 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
} }
?> ?>
</label>
</th> </th>
<td id="front-static-pages"> <td id="front-static-pages">
<form method="post" action=""> <form method="post" action="">
<?php wp_nonce_field( 'set-privacy-page' ); ?>
<input type="hidden" name="action" value="set-privacy-page" /> <input type="hidden" name="action" value="set-privacy-page" />
<fieldset> <?php
<legend class="screen-reader-text"><span><?php _e( 'Select your privacy policy page.' ); ?></span></legend>
<label for="page_for_privacy_policy"> wp_dropdown_pages(
<?php wp_dropdown_pages(
array( array(
'name' => 'page_for_privacy_policy', 'name' => 'page_for_privacy_policy',
'show_option_none' => __( '&mdash; Select &mdash;' ), 'show_option_none' => __( '&mdash; Select &mdash;' ),
@ -168,10 +164,11 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
'post_status' => array( 'draft', 'publish' ), 'post_status' => array( 'draft', 'publish' ),
) )
); );
wp_nonce_field( 'set-privacy-page' );
submit_button( __( 'Set Page' ), 'primary', 'submit', true, array( 'id' => 'set-page' ) );
?> ?>
</label>
</fieldset>
<?php submit_button( __( 'Set Page' ) ); ?>
</form> </form>
</td> </td>
</tr> </tr>
@ -184,8 +181,12 @@ require_once( ABSPATH . 'wp-admin/admin-header.php' );
<td> <td>
<form method="post" action=""> <form method="post" action="">
<input type="hidden" name="action" value="create-privacy-page" /> <input type="hidden" name="action" value="create-privacy-page" />
<?php wp_nonce_field( 'create-privacy-page' ); ?> <?php
<?php submit_button( __( 'Create Page' ) ); ?>
wp_nonce_field( 'create-privacy-page' );
submit_button( __( 'Create Page' ), 'primary', 'submit', true, array( 'id' => 'create-page' ) );
?>
</form> </form>
</td> </td>
</tr> </tr>

View File

@ -4,7 +4,7 @@
* *
* @global string $wp_version * @global string $wp_version
*/ */
$wp_version = '4.9.6-alpha-43098'; $wp_version = '4.9.6-alpha-43099';
/** /**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema. * Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.