Ticket #48409: 48409.2.diff
File 48409.2.diff, 6.0 KB (added by , 5 years ago) |
---|
-
src/wp-admin/includes/class-walker-nav-menu-checklist.php
62 62 * 63 63 * @since 3.0.0 64 64 * 65 * @global int $_nav_menu_placeholder 65 * @global int $_nav_menu_placeholder 66 * @global int|string $nav_menu_selected_id 66 67 * 67 68 * @param string $output Used to append additional content (passed by reference). 68 69 * @param object $item Menu item data object. … … 71 72 * @param int $id Not used. 72 73 */ 73 74 public function start_el( &$output, $item, $depth = 0, $args = array(), $id = 0 ) { 74 global $_nav_menu_placeholder ;75 global $_nav_menu_placeholder, $nav_menu_selected_id; 75 76 76 77 $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1; 77 78 $possible_object_id = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder; … … 81 82 82 83 $output .= $indent . '<li>'; 83 84 $output .= '<label class="menu-item-title">'; 84 $output .= '<input type="checkbox" class="menu-item-checkbox';85 $output .= '<input type="checkbox"' . wp_nav_menu_disabled_check( $nav_menu_selected_id, false ) . ' class="menu-item-checkbox'; 85 86 86 87 if ( ! empty( $item->front_or_home ) ) { 87 88 $output .= ' add-to-top'; -
src/wp-admin/includes/nav-menu.php
255 255 } 256 256 257 257 /** 258 * Check whether to disable the Menu Locations meta box submit button 258 * Check whether to disable the Menu Locations meta box submit button and inputs. 259 259 * 260 260 * @since 3.6.0 261 * @since 5.3.1 The `$echo` parameter was added. 261 262 * 262 263 * @global bool $one_theme_location_no_menus to determine if no menus exist 263 264 * 264 * @param int|string $nav_menu_selected_id (id, name or slug) of the currently-selected menu 265 * @return string Disabled attribute if at least one menu exists, false if not 265 * @param int|string $nav_menu_selected_id ID, name, or slug of the currently selected menu. 266 * @param bool $echo Whether to echo or just return the string. 267 * @return string|false Disabled attribute if at least one menu exists, false if not. 266 268 */ 267 function wp_nav_menu_disabled_check( $nav_menu_selected_id ) {269 function wp_nav_menu_disabled_check( $nav_menu_selected_id, $echo = true ) { 268 270 global $one_theme_location_no_menus; 269 271 270 272 if ( $one_theme_location_no_menus ) { … … 271 273 return false; 272 274 } 273 275 274 return disabled( $nav_menu_selected_id, 0 );276 return disabled( $nav_menu_selected_id, 0, $echo ); 275 277 } 276 278 277 279 /** … … 292 294 <input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" /> 293 295 <p id="menu-item-url-wrap" class="wp-clearfix"> 294 296 <label class="howto" for="custom-menu-item-url"><?php _e( 'URL' ); ?></label> 295 <input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text" class="code menu-item-textbox" placeholder="https://" />297 <input id="custom-menu-item-url" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-url]" type="text"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="code menu-item-textbox" placeholder="https://" /> 296 298 </p> 297 299 298 300 <p id="menu-item-name-wrap" class="wp-clearfix"> 299 301 <label class="howto" for="custom-menu-item-name"><?php _e( 'Link Text' ); ?></label> 300 <input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text" class="regular-text menu-item-textbox" />302 <input id="custom-menu-item-name" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-title]" type="text"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="regular-text menu-item-textbox" /> 301 303 </p> 302 304 303 305 <p class="button-controls wp-clearfix"> … … 569 571 ?> 570 572 <p class="quick-search-wrap"> 571 573 <label for="quick-search-posttype-<?php echo $post_type_name; ?>" class="screen-reader-text"><?php _e( 'Search' ); ?></label> 572 <input type="search" class="quick-search" value="<?php echo $searched; ?>" name="quick-search-posttype-<?php echo $post_type_name; ?>" id="quick-search-posttype-<?php echo $post_type_name; ?>" />574 <input type="search"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> class="quick-search" value="<?php echo $searched; ?>" name="quick-search-posttype-<?php echo $post_type_name; ?>" id="quick-search-posttype-<?php echo $post_type_name; ?>" /> 573 575 <span class="spinner"></span> 574 576 <?php submit_button( __( 'Search' ), 'small quick-search-submit hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-posttype-' . $post_type_name ) ); ?> 575 577 </p> … … 651 653 652 654 <p class="button-controls wp-clearfix" data-items-type="posttype-<?php echo esc_attr( $post_type_name ); ?>"> 653 655 <span class="list-controls hide-if-no-js"> 654 <input type="checkbox" id="<?php echo esc_attr( $post_type_name . '-tab' ); ?>" class="select-all" />656 <input type="checkbox"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> id="<?php echo esc_attr( $post_type_name . '-tab' ); ?>" class="select-all" /> 655 657 <label for="<?php echo esc_attr( $post_type_name . '-tab' ); ?>"><?php _e( 'Select All' ); ?></label> 656 658 </span> 657 659 … … 880 882 881 883 <p class="button-controls wp-clearfix" data-items-type="taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>"> 882 884 <span class="list-controls hide-if-no-js"> 883 <input type="checkbox" id="<?php echo esc_attr( $taxonomy_name . '-tab' ); ?>" class="select-all" />885 <input type="checkbox"<?php wp_nav_menu_disabled_check( $nav_menu_selected_id ); ?> id="<?php echo esc_attr( $taxonomy_name . '-tab' ); ?>" class="select-all" /> 884 886 <label for="<?php echo esc_attr( $taxonomy_name . '-tab' ); ?>"><?php _e( 'Select All' ); ?></label> 885 887 </span> 886 888