Created
January 4, 2016 23:01
-
-
Save jondcampbell/b067210252e4ee48c143 to your computer and use it in GitHub Desktop.
CMB2 File List: Don't show media from other posts. The key is the query_args that tell the media uploader to only show the resources uploaded to post 99999999999 (which I hope never exists).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$this->cmb_form->add_field( array( | |
'name' => 'Resource File List', | |
'desc' => '', | |
'id' => $this->cmb_prefix . 'resource_files', | |
'type' => 'file_list', | |
// 'preview_size' => array( 100, 100 ), // Default: array( 50, 50 ) | |
'attributes' => array( | |
'required' => true, // Will be required only if visible. | |
'data-conditional-id' => $this->cmb_prefix . 'resource_type', | |
'data-conditional-value' => 'files', | |
), | |
'query_args' => array( | |
'uploadedTo' => 99999999999, | |
), | |
) ); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment