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.

git-svn-id: https://develop.svn.wordpress.org/trunk@47770 602fd350-edb4-49c9-b593-d223f7449a82
This commit is contained in:
Sergey Biryukov 2020-05-06 19:33:45 +00:00
parent bb526f5087
commit 26439dd788
1 changed files with 39 additions and 26 deletions

View File

@ -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 ) ) {
@ -940,6 +941,7 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
<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;
@ -947,12 +949,15 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
?>
<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;
@ -1014,7 +1019,13 @@ 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 ) : ?>
<?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
@ -1034,6 +1045,8 @@ require_once ABSPATH . 'wp-admin/admin-header.php';
"><?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' ) ); ?>
</div><!-- END .publishing-action -->