Home>Support>Page Builder Custom Widget: Media Library Showing “

Page Builder Custom Widget: Media Library Showing “

I am creating a series of custom plugins for use with Page Builder, and using the original SiteOrigin widgets as my model. Everything’s working great, except for a very particular issue involving the Media Library for files.

My widget allows for the option to upload a file. Here’s the rough code:

'downloadFile' => array(
	'type' => 'media',
	'choose' => __( 'Choose file', 'widget-form-fields-text-domain' ),
	'update' => __( 'Set file', 'widget-form-fields-text-domain' ),
	'library' => 'file' //'image', 'audio', 'video', 'file'
)

I can upload a .PSD file no problem. But when I click on the “Choose file” button, and the “Choose file” modal appears… it shows that my Media Library is empty. But when I go and directly view my Media Library, I see a whole bunch of PSD files.

When I change the library reference (in the code above) to “image,” the upload process works just fine. And when the modal appears, I see all of my prior image uploads show up in the Media Library tab. I’m not sure how best to go about fixing this issue, and any help would be greatly appreciated.

As a note, the only plugins I’m using are:
– Page Builder by SiteOrigin
– SiteOrigin Widgets Bundle

I’m also developing locally, so unfortunately don’t have a public URL to share. I’m hoping the problem is straightforward enough that my description makes sense. I can upload some screenshots and link them, if that would help.

Any insight or assistance greatly appreciated!
-Felix

This is our free support forum. Replies can take several days. If you need fast email support, please purchase a SiteOrigin Premium license.

  1. 9 years, 8 months ago avoision

    Title should have been:
    Page Builder Custom Widget: Media Library Showing “No items found”

    Got too excited, and hit submit early. If a mod could update the title, that would be appreciated!

  2. 9 years, 8 months ago avoision

    As a follow-up, I’ve tried testing out the various library types. And everything works as expected, except for when I’m using “file” and uploading PSD or ZIP files.

    ‘library’ => ‘image’ : The “Choose file” modal shows prior images that I’ve uploaded.
    ‘library’ => ‘audio’ : The “Choose file” modal shows prior mp3 files that I’ve uploaded.
    ‘library’ => ‘video’ : The “Choose file” modal shows prior .mp4 files that I’ve uploaded.
    ‘library’ => ‘file’ : The “Choose file” modal shows “No items found,” despite .psd/.zip files existing. Files are visible when navigating to Media > Library

    Again, hoping there is some easy fix here as everything seems to behave as expected.

  3. 9 years, 8 months ago avoision

    Got lucky and solved it! “File” didn’t work for me, but “application” did.

    'library' => 'application'
    

    I went digging around in the main functions.php file, and the big mime types list was what helped.

  4. 9 years, 8 months ago Andrew Misplon
    Hi, I Work Here

    Hi avoision

    Thanks for the updates here. I’ll get Braam our chief Widgets Bundle developer to check in here tomorrow and see what he can add.

    Chat then.

  5. 9 years, 8 months ago Greg Priday
    Hi, I Work Here

    Hi avoision

    I’ll need to check this properly, but as far as I remember, that library attribute corresponds to the file MIME type. So image will match image/* MIME type. PSDs have the MIME type of application/pdf (according to WordPress), so you would need to use the ‘library’ value of application to match them.

    You can check the output of the function wp_get_mime_types to see all the MIME types WordPress uses.

Replies on this thread are closed. Please create a new thread if you have a question, or purchase a SiteOrigin Premium license if you need one-on-one email support.

Get The Most Out of SiteOrigin with SiteOrigin Premium

Find Out More