I am using Drupal Lightning 8.x.2.2.3. And I am using the the built in Lightning Embed button (the one with the Star icon) added to the Ckeditor to add media to the body. The Embed button is using the Media Browser. On the Embed button settings page here: /admin/config/content/embed/button/manage/media_browser?destination=/admin/config/content/embed. There is a filter to restrict by Media Type. It says If none are selected, all are allowed. This option does not restrict anything, is this a bug? I have the Document Type checked and it still allows Images when I go to upload media. Example when I click one the Embed button in the Ckeditor. And then I click on tab Upload. The widget 'file upload' is being used. And I can upload images. Can a custom hook be created to restrict file types through the File Upload widget? I know you can further restrict file types here: /admin/structure/media/manage/image/fields/. But I need to restrict it up further at the browser on button level. The other widget called 'Upload images as media items' has a setting to restrict by file types. But it uses a different form ID then File Upload widget. The 2 widget work Differently.

  • This doesn't restrict the file type allowed (.jpg vs .doc), it only restricts the media types permitted. The media type can dictate (per its fields) what is and is not allowed. Media Types are similar to Node Types, an object to hold data. Uploading files directly via other means like file upload or IMCE sends it directly to the file system and I believe does not register them as Media entities. This is probably not desired. – Kevin May 21 '18 at 20:17
  • Thanks Kevin, I understand now and through testing the functionality.You are right. Why then is the filter to restrict by Media Type (Document vs. Image) be changed to restrict by allowed extension that are allowed in the Bundle type. Is there a hook that can be used for the form ID 'entity_embed_dialog' that can restrict file types or media bundle type? – paulcap1 May 22 '18 at 1:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.