Open maxime-rainville opened 1 year ago
The InsertMediaModal
is a component in AssetAdmin that allows to render the assets section in a Modal to select a file in various context. Each use case of this Modal is hard coded into it. The following use case are supported:
The problem is that getting any other use case working would require us to hardcode them in asset-admin.
The SPIKE Identify opportunities to refactor InsertMediaModal identified some refactoring opportunities that could make the modal more flexible. The work highlighted in there would be a pre-requiste to getting this card working.
An alternative could be to take the same approach we ended up taking in LinkField v4: get the UploadField working in a Form Schema modal.
It's worth pointing that this could fulfill an old dream of mine: basically, allowing a dev to define some bit of metadata to attach to file when displaying it in context.
Example where this could be helpful:
https://github.com/silverstripe/silverstripe-asset-admin/issues/1021
The current FileLink modal is reusing the modal used to create WYSIWYG FileLink ... which doesn't allow more complex use case.
There could be a cool use case for providing a flexible Modal that allows you to pick a File and attach extra bit of MetaData to it. e.g. Select an image for a Slide in a carousel.
Basically any ManyMany relation between a file and another object with some metadata stored on the relation table could use this.