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.
I would like to restrict IMCE users to a certain directory based on the content type that the WYSIWYG editor is in.
Similar to what filefield_sources has, where a image field can restrict IMCE to browse and upload only to that image's file directory.
I am not sure if this is possible, but I have looked everywhere and can't find anything. Any help would be great.
Comments
Comment #1
mr_kazoodle CreditAttribution: mr_kazoodle commentedsubscribing
I would really like to have this functionality: my users cannot be trusted to know what to do.
Comment #2
nixar CreditAttribution: nixar commentedsubscribing
Comment #3
komlenic CreditAttribution: komlenic as a volunteer commentedIn the IMCE directory settings, in addition to adding a string to specify a path, you can supply php code beginning with "php:". Whatever this code returns, will be the path used by IMCE - in this way you can set the directory per content-type (or many other conditions). In the case of a subdirectory for a given content type, something like this will work:
Assuming your content type is named "foo":
Of course, you'll need to preface that code above with the string "php: " and remove all the newlines.