Make WordPress Core

Changeset 56712

Timestamp:
09/26/2023 03:03:19 PM (10 months ago)
Author:
costdev
Message:

Quick/Bulk Edit: Pre-fill category fields with their status.

This pre-fills category fields in the Quick/Bulk Edit form with their current status.

When bulk editing, if only some of the selected items are in a given category, the category's checkbox will display a line to indicate an indeterminate status.

Props pavelevap, scribu, chasedsiedu, helen, joshcanhelp, ubernaut, Cyberchicken, laumindproductscomau, SergeyBiryukov, Marcoevich, tomybyte, thinkluke, virtality-marketing-solutions, Michalooki, dmsnell, itecrs, pannelars, WHSajid, samba45, Mte90, johnbillion, tomluckies, soulseekah, francina, oglekler, ajmcfadyen, mukesh27, costdev.
Fixes #11302.

Location:
trunk/src
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/js/_enqueues/admin/inline-edit-post.js

    r56022 r56712  
    179179    setBulk : function(){
    180180        var te = '', type = this.type, c = true;
     181
     182
     183
    181184        this.revert();
    182185
     
    217220        // Populate the list of items to bulk edit.
    218221        $( '#bulk-titles' ).html( '<ul id="bulk-titles-list" role="list">' + te + '</ul>' );
     222
     223
     224
     225
     226
     227
     228
     229
     230
     231
     232
     233
     234
     235
     236
     237
     238
     239
     240
     241
     242
     243
     244
     245
     246
     247
     248
     249
     250
     251
     252
     253
     254
     255
     256
     257
     258
     259
     260
    219261
    220262        /**
  • trunk/src/wp-admin/css/list-tables.css

    r56665 r56712  
    11481148}
    11491149
     1150
     1151
     1152
     1153
     1154
     1155
     1156
     1157
     1158
     1159
     1160
    11501161#bulk-titles .ntdelbutton,
    11511162#bulk-titles .ntdeltitle,
  • trunk/src/wp-admin/includes/post.php

    r56587 r56712  
    642642
    643643        if ( isset( $new_cats ) && in_array( 'category', $tax_names, true ) ) {
    644             $cats                       = (array) wp_get_post_categories( $post_id );
    645             $post_data['post_category'] = array_unique( array_merge( $cats, $new_cats ) );
     644            $cats = (array) wp_get_post_categories( $post_id );
     645
     646            if (
     647                isset( $post_data['indeterminate_post_category'] )
     648                && is_array( $post_data['indeterminate_post_category'] )
     649            ) {
     650                $indeterminate_post_category = $post_data['indeterminate_post_category'];
     651            } else {
     652                $indeterminate_post_category = array();
     653            }
     654
     655            $indeterminate_cats         = array_intersect( $cats, $indeterminate_post_category );
     656            $determinate_cats           = array_diff( $new_cats, $indeterminate_post_category );
     657            $post_data['post_category'] = array_unique( array_merge( $indeterminate_cats, $determinate_cats ) );
     658
    646659            unset( $post_data['tax_input']['category'] );
    647660        }
Note: See TracChangeset for help on using the changeset viewer.