Changeset 47122 for trunk/src/wp-admin/nav-menus.php
- Timestamp:
- 01/29/2020 12:43:23 AM (6 years ago)
- File:
-
- 1 edited
-
trunk/src/wp-admin/nav-menus.php (modified) (9 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/wp-admin/nav-menus.php
r47093 r47122 13 13 require_once( dirname( __FILE__ ) . '/admin.php' ); 14 14 15 // Load all the nav menu interface functions 15 // Load all the nav menu interface functions. 16 16 require_once( ABSPATH . 'wp-admin/includes/nav-menu.php' ); 17 17 … … 20 20 } 21 21 22 // Permissions Check22 // Permissions check. 23 23 if ( ! current_user_can( 'edit_theme_options' ) ) { 24 24 wp_die( … … 35 35 } 36 36 37 // Container for any messages displayed to the user 37 // Container for any messages displayed to the user. 38 38 $messages = array(); 39 39 40 // Container that stores the name of the active menu 40 // Container that stores the name of the active menu. 41 41 $nav_menu_selected_title = ''; 42 42 43 // The menu id of the current menu being edited 43 // The menu id of the current menu being edited. 44 44 $nav_menu_selected_id = isset( $_REQUEST['menu'] ) ? (int) $_REQUEST['menu'] : 0; 45 45 46 // Get existing menu locations assignments 46 // Get existing menu locations assignments. 47 47 $locations = get_registered_nav_menus(); 48 48 $menu_locations = get_nav_menu_locations(); 49 49 $num_locations = count( array_keys( $locations ) ); 50 50 51 // Allowed actions: add, update, delete 51 // Allowed actions: add, update, delete. 52 52 $action = isset( $_REQUEST['action'] ) ? $_REQUEST['action'] : 'edit'; 53 53 … … 326 326 } 327 327 if ( isset( $_REQUEST['zero-menu-state'] ) ) { 328 // If there are menu items, add them 328 // If there are menu items, add them. 329 329 wp_nav_menu_update_menu_items( $nav_menu_selected_id, $nav_menu_selected_title ); 330 // Auto-save nav_menu_locations 330 // Auto-save nav_menu_locations. 331 331 $locations = get_nav_menu_locations(); 332 332 foreach ( $locations as $location => $menu_id ) { 333 333 $locations[ $location ] = $nav_menu_selected_id; 334 break; // There should only be 1 334 break; // There should only be 1. 335 335 } 336 336 set_theme_mod( 'nav_menu_locations', $locations ); … … 400 400 $new_menu_locations = array_map( 'absint', $_POST['menu-locations'] ); 401 401 $menu_locations = array_merge( $menu_locations, $new_menu_locations ); 402 // Set menu locations 402 // Set menu locations. 403 403 set_theme_mod( 'nav_menu_locations', $menu_locations ); 404 404 … … 472 472 $nav_menu_selected_id = 0; 473 473 } elseif ( empty( $nav_menu_selected_id ) && ! empty( $nav_menus ) && ! $add_new_screen ) { 474 // if we have no selection yet, and we have menus, set to the first one in the list.474 // If we have no selection yet, and we have menus, set to the first one in the list. 475 475 $nav_menu_selected_id = $nav_menus[0]->term_id; 476 476 } … … 537 537 } 538 538 539 if ( ! $locations_screen ) : // Main tab 539 if ( ! $locations_screen ) : // Main tab. 540 540 $overview = '<p>' . __( 'This screen is used for managing your navigation menus.' ) . '</p>'; 541 541 $overview .= '<p>' . sprintf( … … 585 585 ) 586 586 ); 587 else : // Locations Tab.587 else : // Locations tab. 588 588 $locations_overview = '<p>' . __( 'This screen is used for globally assigning menus to locations defined by your theme.' ) . '</p>'; 589 589 $locations_overview .= '<ul><li>' . __( 'To assign menus to one or more theme locations, <strong>select a menu from each location’s drop down.</strong> When you’re finished, <strong>click Save Changes</strong>' ) . '</li>'; … … 746 746 </td><!-- .menu-location-menus --> 747 747 </tr><!-- .menu-locations-row --> 748 <?php } // foreach?>748 <?php } // End foreach. ?> 749 749 </tbody> 750 750 </table>
Note: See TracChangeset
for help on using the changeset viewer.