First of all: great module! First I tried to make something myself, then I tried to use 'entity_usage' with custom code (https://www.drupal.org/project/entity_usage/issues/3084863), but your approach is more simple an scalable.
I would say its very useful for a better user-experience in many cases.
In our case we have nodes with nested paragraphs, so we had to change some code. For now it fits our use-case, but maybe we could make it more generic?
1) media_library_filter_entity_presave: here we loop on our nested paragraphs structure to find all fields storing media.
I can imagine 2 solutions: to extend you module with a hook so other developers can use a custom presave, other option is to make a recursive function that finds all media in nested structures, what do think is the best way to solve this?
2) We also had to add a custom token since the opener of the widget in our case is not a node but a nested paragraph. Maybe a generic token which recursively traverses up till it finds a node could work?
3) We had to customise media_library_filter_form_media_library_add_form_upload_alter since our opener is a paragraph, not a node.
Let me know your thoughts, we can maybe provide some patches (will take some time, holiday is coming + deadlines).
Comments
Comment #2
viappidu commentedI believe you have done possibly more work on it than me.
I am quite caught on other issues so I've been procrastinating on this one.
As you might have seen I opened up an extra couple of issues that I will have to look into again.
I think I also had few problems installing and uninstalling the module and I don't remember clearly if I fixed those wither.
I'm open to any solution you'll see fit. I made a version because at the time if was satisfying my need though it still need a lot of work...
I would start though creating a field in media to store arrays keyed by entity type m(not just node/single entity type).
Am I thinking wrong?
Sorry if I let you work the most!
Comment #3
workplaysleep commentedSorry for the late reply, for now we switched to https://www.drupal.org/project/inline_entity_form which requires less custom coding. But a mixture of this and your approach would give a better use-case for our scenario.
We use media, but don't want the library, just the references for the current field, but we do want bulk upload multiple images + a visual grid. Maybe we do some custom coding (if the project needs it) later on, but for now: feel free to close this issue.