Make WordPress Core

Ticket #48409: 48409.2.diff

File 48409.2.diff, 6.0 KB (added by SergeyBiryukov, 5 years ago)
  • src/wp-admin/includes/class-walker-nav-menu-checklist.php

     
    6262         *
    6363         * @since 3.0.0
    6464         *
    65          * @global int $_nav_menu_placeholder
     65         * @global int        $_nav_menu_placeholder
     66         * @global int|string $nav_menu_selected_id
    6667         *
    6768         * @param string $output Used to append additional content (passed by reference).
    6869         * @param object $item   Menu item data object.
     
    7172         * @param int    $id     Not used.
    7273         */
    7374        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;
    7576
    7677                $_nav_menu_placeholder = ( 0 > $_nav_menu_placeholder ) ? intval( $_nav_menu_placeholder ) - 1 : -1;
    7778                $possible_object_id    = isset( $item->post_type ) && 'nav_menu_item' == $item->post_type ? $item->object_id : $_nav_menu_placeholder;
     
    8182
    8283                $output .= $indent . '<li>';
    8384                $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';
    8586
    8687                if ( ! empty( $item->front_or_home ) ) {
    8788                        $output .= ' add-to-top';
  • src/wp-admin/includes/nav-menu.php

     
    255255}
    256256
    257257/**
    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.
    259259 *
    260260 * @since 3.6.0
     261 * @since 5.3.1 The `$echo` parameter was added.
    261262 *
    262263 * @global bool $one_theme_location_no_menus to determine if no menus exist
    263264 *
    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.
    266268 */
    267 function wp_nav_menu_disabled_check( $nav_menu_selected_id ) {
     269function wp_nav_menu_disabled_check( $nav_menu_selected_id, $echo = true ) {
    268270        global $one_theme_location_no_menus;
    269271
    270272        if ( $one_theme_location_no_menus ) {
     
    271273                return false;
    272274        }
    273275
    274         return disabled( $nav_menu_selected_id, 0 );
     276        return disabled( $nav_menu_selected_id, 0, $echo );
    275277}
    276278
    277279/**
     
    292294                <input type="hidden" value="custom" name="menu-item[<?php echo $_nav_menu_placeholder; ?>][menu-item-type]" />
    293295                <p id="menu-item-url-wrap" class="wp-clearfix">
    294296                        <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://" />
    296298                </p>
    297299
    298300                <p id="menu-item-name-wrap" class="wp-clearfix">
    299301                        <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" />
    301303                </p>
    302304
    303305                <p class="button-controls wp-clearfix">
     
    569571                        ?>
    570572                        <p class="quick-search-wrap">
    571573                                <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; ?>" />
    573575                                <span class="spinner"></span>
    574576                                <?php submit_button( __( 'Search' ), 'small quick-search-submit hide-if-js', 'submit', false, array( 'id' => 'submit-quick-search-posttype-' . $post_type_name ) ); ?>
    575577                        </p>
     
    651653
    652654                <p class="button-controls wp-clearfix" data-items-type="posttype-<?php echo esc_attr( $post_type_name ); ?>">
    653655                        <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" />
    655657                                <label for="<?php echo esc_attr( $post_type_name . '-tab' ); ?>"><?php _e( 'Select All' ); ?></label>
    656658                        </span>
    657659
     
    880882
    881883                <p class="button-controls wp-clearfix" data-items-type="taxonomy-<?php echo esc_attr( $taxonomy_name ); ?>">
    882884                        <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" />
    884886                                <label for="<?php echo esc_attr( $taxonomy_name . '-tab' ); ?>"><?php _e( 'Select All' ); ?></label>
    885887                        </span>
    886888