Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More versatile FileModal #12

Open
maxime-rainville opened this issue Aug 10, 2023 · 2 comments
Open

More versatile FileModal #12

maxime-rainville opened this issue Aug 10, 2023 · 2 comments

Comments

@maxime-rainville
Copy link
Owner

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.

@maxime-rainville
Copy link
Owner Author

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:

  • Select a file in an UploadField
  • Insert an image in a WYSIWIG
  • Insert a link to a file in the WYSIWYG

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.

@maxime-rainville
Copy link
Owner Author

maxime-rainville commented Feb 7, 2024

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:

  • I want to have a list of banners with a call to action and a link
  • I want to attach focus point to a specific instance of an image on a page

silverstripe/silverstripe-asset-admin#1021

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Development

No branches or pull requests

2 participants