Menus: Add a Cancel link to the screen for creating a new menu.

The use case this helps the most is when there's only one menu and you click "create a new menu". In this case the Cancel link allows you to go back to the single existing menu.

Props garrett-eclipse, audrasjb.
Fixes #46367.
Built from https://develop.svn.wordpress.org/trunk@47770


git-svn-id: http://core.svn.wordpress.org/trunk@47546 1a063a9b-81f0-0310-95a4-ce76da25c4cd
This commit is contained in:
Sergey Biryukov 2020-05-06 19:35:11 +00:00
parent bf3296a9a0
commit a0224a579d
2 changed files with 40 additions and 27 deletions

View File

@ -887,7 +887,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
<div id="menu-management">
<form id="update-nav-menu" method="post" enctype="multipart/form-data">
<?php
$new_screen_class = '';
$new_screen_class = '';
if ( $add_new_screen ) {
$new_screen_class = 'blank-slate';
}
@ -925,6 +925,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
<div id="post-body">
<div id="post-body-content" class="wp-clearfix">
<?php if ( ! $add_new_screen ) : ?>
<?php
$hide_style = '';
if ( isset( $menu_items ) && 0 == count( $menu_items ) ) {
@ -937,26 +938,30 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
$starter_copy = __( 'Drag the items into the order you prefer. Click the arrow on the right of the item to reveal additional configuration options.' );
}
?>
<div class="drag-instructions post-body-plain" <?php echo $hide_style; ?>>
<p><?php echo $starter_copy; ?></p>
</div>
<div class="drag-instructions post-body-plain" <?php echo $hide_style; ?>>
<p><?php echo $starter_copy; ?></p>
</div>
<?php
if ( isset( $edit_markup ) && ! is_wp_error( $edit_markup ) ) {
echo $edit_markup;
} else {
?>
<ul class="menu" id="menu-to-edit"></ul>
<ul class="menu" id="menu-to-edit"></ul>
<?php } ?>
<?php endif; ?>
<?php if ( $add_new_screen ) : ?>
<p class="post-body-plain" id="menu-name-desc"><?php _e( 'Give your menu a name, then click Create Menu.' ); ?></p>
<?php if ( isset( $_GET['use-location'] ) ) : ?>
<input type="hidden" name="use-location" value="<?php echo esc_attr( $_GET['use-location'] ); ?>" />
<?php endif; ?>
<?php
endif;
$no_menus_style = '';
<?php
endif;
$no_menus_style = '';
if ( $one_theme_location_no_menus ) {
$no_menus_style = 'style="display: none;"';
}
@ -1014,25 +1019,33 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
</div><!-- /#post-body -->
<div id="nav-menu-footer">
<div class="major-publishing-actions wp-clearfix">
<?php if ( 0 != $menu_count && ! $add_new_screen ) : ?>
<span class="delete-action">
<a class="submitdelete deletion menu-delete" href="
<?php
echo esc_url(
wp_nonce_url(
add_query_arg(
array(
'action' => 'delete',
'menu' => $nav_menu_selected_id,
<?php if ( $menu_count > 0 ) : ?>
<?php if ( $add_new_screen ) : ?>
<span class="cancel-action">
<a class="submitcancel cancellation menu-cancel" href="<?php echo esc_url( admin_url( 'nav-menus.php' ) ); ?>"><?php _e( 'Cancel' ); ?></a>
</span><!-- END .cancel-action -->
<?php else : ?>
<span class="delete-action">
<a class="submitdelete deletion menu-delete" href="
<?php
echo esc_url(
wp_nonce_url(
add_query_arg(
array(
'action' => 'delete',
'menu' => $nav_menu_selected_id,
),
admin_url( 'nav-menus.php' )
),
admin_url( 'nav-menus.php' )
),
'delete-nav_menu-' . $nav_menu_selected_id
)
);
?>
"><?php _e( 'Delete Menu' ); ?></a>
</span><!-- END .delete-action -->
'delete-nav_menu-' . $nav_menu_selected_id
)
);
?>
"><?php _e( 'Delete Menu' ); ?></a>
</span><!-- END .delete-action -->
<?php endif; ?>
<?php endif; ?>
<div class="publishing-action">
<?php submit_button( empty( $nav_menu_selected_id ) ? __( 'Create Menu' ) : __( 'Save Menu' ), 'primary large menu-save', 'save_menu', false, array( 'id' => 'save_menu_footer' ) ); ?>

View File

@ -13,7 +13,7 @@
*
* @global string $wp_version
*/
$wp_version = '5.5-alpha-47769';
$wp_version = '5.5-alpha-47770';
/**
* Holds the WordPress DB revision, increments when changes are made to the WordPress DB schema.