Custom Module settings field, file picker


We are creating a custom slideshow module where the client can choose different slide types, eg. if the slide in the slideshow should be text, image and then we want to have a special pdf slide.

So in this case the client should be able to pick out a pdf from the media library or upload a pdf, so very much similar how the Photo settings field works but instead of photos it should only accept pdf files.

I was thinking that there would be like a general media library settings field that we could use and maybe even set which mime types it accepted but from what I see in the documentation ( there are no such standard field settings types? I guess our option would then be to create a custom setting field?

Appreciate your help!



We noticed the same thing and ended up copying and modifying the photo field specifically for PDFs. Feel free to use it –

Everything is prefixed with zestsms to not conflict if/when they create a PDF upload field.

Great Josh, really appreciate it!

However I think something like this should be included in the core plugin, at least a more flexible media field which not only works with photos.

Hi Josh,

thanks for sharing this, was about to do the exact same thing (modify the photo field) but this saves me lots of time and trouble.

Sorry for reviving an old thread.

edit: btw, made your code into a plugin to enable easy distribution.