[5.2] Media field: selectable folders
Summary of Changes
The PR add posibility to select directories usign the Media field. This is helpfull when the site have multiple Media adapters.
Testing Instructions
Run npm install.
Create custom field Media, Pick the directory in the "Directory" option.
Edit TinyMCE (plugin config) "Images Directory" (when "Images Drag and Drop" is On). And test TinyMCE drag and drop upload.
Actual result BEFORE applying this Pull Request
You able to pick only one of folder under /images
Expected result AFTER applying this Pull Request
You can pick any directory that available in the Media manager
Link to documentations
Please select:
- [ ] Documentation link for docs.joomla.org: https://docs.joomla.org/Media_form_field_type
- [ ] No documentation changes for docs.joomla.org needed
- [ ] Pull Request link for manual.joomla.org: TBD
- [ ] No documentation changes for manual.joomla.org needed
Works fine for custom fields but what about in the media plugin? These are all subdirectories of /images
@Fedik you could probably patch also this event: https://github.com/joomla/joomla-cms/blob/dfb572de83d16a25e7eee673b3875e18750e688b/administrator/components/com_media/resources/scripts/components/tree/tree.vue#L85 So selecting a folder on the left (disk/folder tree) could be also a valid way to select the folder
@brianteeman I forgot it exists, should be good now. @dgrammatiko updated
Is it possible to use something other than "types" as I am sure people will confuse it with "type"
Is it possible to use something other than "types" as I am sure people will confuse it with "type"
That would be a b/c break so no
Nope, unfortunately. It is what we already use https://github.com/joomla/joomla-cms/blob/bea594e404224ab404fe76ca55e5f9910227f183/libraries/src/Form/Field/MediaField.php#L237 For the Media field.
ok fair enough. I searched for types = and got no hits - didn't think about types =
;)
I also updated TinyMCE upload directory for "drag and drop", to use this feature.
Nice work. I tested it with DPMedia and the FTP plugin, unfortunately when I select a folder from the FTP adapter, the field stays empty in the media custom field.
@laoneo is right, this approach will never work for anything else other than the local filesystem. Maybe having dolder/path#adapterName://folder could work, but would need patches all over I guess
Thanks for checking. I did not have a time to test with external adapters, and expected it works. I will update later
There is a free version of DPMedia with the FTP adapter if you want to try it by yourself.
I have checked. The field "Content - DPMedia" override configuration form for the Media Custom field (with own field for it). You need to disable this plugin then it will work.
After I disable that plugin it works for me
I tested it, when it was disabled. The error I did, I didn't select the folder in the media manager, I just navigated to the folder I wanted to test and then hit the select button. Like in this screenshot:
I just navigated to the folder I wanted to test and then hit the select button
Hm, it also works for me. You navigating with Tree select or Breadcrumbs? Breadcrumbs does not do anything, but Tree should work.
I clicked the folder inside the main area, where the folders are listed, not the tree or breadcrumbs.
I clicked the folder inside the main area, where the folders are listed, not the tree or breadcrumbs.
So you clicked it twice to open? The media manager cannot handle it as "select".
There only one way to select something in media manager, is to tick the checkbox on the image/folder. And one addittional way for folders is to click the folder in Tree view.
Yeah, well, it can be confusing.
I double clicked on the last folder inside the main area and then the select button. But I had to do it by being in the parent and then select the folder with the checkbox and not navigating into the folder and then click select.
I have update PR, now the folder should be also selectable on "double click".
This worked perfectly, also with navigation into another folder and with other adapters than the local one.
I have tested this item :white_check_mark: successfully on 3223f82594c969c70c2c8bafbd39fcec9495d976
See my last comment
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43579.
I have tested this item :white_check_mark: successfully on 3223f82594c969c70c2c8bafbd39fcec9495d976
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43579.
I have tested this item :white_check_mark: successfully on 3223f82594c969c70c2c8bafbd39fcec9495d976
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43579.
RTC
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43579.
Just a note for the person that would merge this PR: ~~depending on the order of committing this PR and #43823 the one that would be second would have to update the extra event introduced in~~ please merge first this PR and then #43823.
This feature is nice and I will merge it as soon as drone has passed. One thing which I find strange however is, that you can set it to a subfolder, but then you can still move up the folders and select a different folder. This is also present in the current implementation, but if I set it to folder X, I wouldn't expect to be able to upload in a parent folder of that.
Thanks @Fedik for your contribution. :-)