Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
If someone wants to add advanced file upload validators depending on the context, eg $node instance, has to use hook_field_widget_form_alter and add #upload_validators..but #media element does not respect that because it has its own #media_options that passes to its media browser plugins.
But even instead of passing validators to #upload_validators and pass it in #media_options[global]
file_entity_add_upload() still hardcodes its validators, even something can be in $options array..
well i am gonna attach a patch with the simplest solution i found so far
Comment | File | Size | Author |
---|---|---|---|
#1 | file_entity-upload_validators-1883864-1.patch | 547 bytes | ParisLiakos |
Comments
Comment #1
ParisLiakos CreditAttribution: ParisLiakos commentedComment #2
ParisLiakos CreditAttribution: ParisLiakos commentedhttp://drupalcode.org/project/file_entity.git/commit/63af8b0
Comment #4
semei CreditAttribution: semei commentedI still encounter a problem with file_entity_edit_validate() and I suppose that the report belongs here. When I upload a video to my media library using Media: Vimeo (i.e. when I add an external video file from the web) then after the file is added to my library I get the following error message:
Notice: Undefined index: #upload_validators in file_entity_edit_validate() (line 699 of [...]\sites\all\modules\file_entity\file_entity.pages.inc).