CMB2 / CMB2

CMB2 is a developer's toolkit for building metaboxes, custom fields, and forms for WordPress that will blow your mind.
GNU General Public License v3.0
2.95k stars 573 forks source link

Fieldparameter column not working on contenttype attachment #1418

Open Dafnie opened 3 years ago

Dafnie commented 3 years ago

Describe the bug

The custom column is not displayed on wp-admin/upload.php. Only working on wp-admin/edit.php?post_type=page

Steps to reproduce

  1. Create this code.

    add_action( 'cmb2_admin_init', function() {
    
    /**
     * Initiate the metabox for Attechment
     */
     $cmbp = new_cmb2_box( [
        'id'            => 'metabox_attachment',
        'title'         => 'Member section',
        'object_types'  => [ 'attachment', 'page' ], // Post type
        'context'       => 'side',
        'priority'      => 'high',
        'show_names'    => true
    ] );
    
    $cmbp->add_field( [
                'name'   => 'Protect file',
            'desc'   => 'Restrict access to only login users',
        'id'     => 'meta_member',
                'column' => true,
        'type'   => 'checkbox'
    ]);
    
    $cmbp->add_field( [
                'name'   => 'sdfsdf file',
        'desc'   => 'Restricsdfsdfsdft access to only login users',
        'id'     => 'meta_memdfdfber',
                'column' => true,
        'type'   => 'test'
    ]);
    } );
  2. Add a few image to the mediamamager
  3. View "wp-admin/edit.php?post_type=page". The two custom column is displayed.
  4. View "wp-admin/upload.php". The two custom column is NOT displayed.
jtsternberg commented 3 years ago

Thank you for reporting. This definitely does seem like a bug.