Problem/Motivation
Media items in the media library have an "i" (Information) bubble that, when clicked, open a wonderful sidepanel on the right of the media library showing information about the media.
It would be great to be able to alter this information and for example add information from further fields. Programmatically and maybe through the UI.
Steps to reproduce
See above.
Proposed resolution
- Code-wise I think there should be an alter hook to add further information to this panel or alter existing.
- If it makes sense, the results could be retrieved from a certain view mode, so fields to be shown there could be added and configured easily through the UI. Maybe we could just use the field from the
media_library view mode?
- If it makes sense, the contents should run through an overrideable twig template per item and for the whole list
The data has a list structure, so I think they should be handled as array, maybe with a unique (field name) string key?
Remaining tasks
- Discuss
- Implement
- Test
- Release
User interface changes
API changes
Data model changes
Comments
Comment #2
anybodyComment #3
anybodyIf I just didn't see or find it, I think it needs an .api.php file to inform about the hook and maybe some documentation if fields can already be configured or added in the UI?
Comment #4
anybodyComment #5
anybodyShould we maybe split this task into separate tasks as of the 1-3 list?
Comment #6
anybody@ytsurk: Is this already possible?
Comment #7
rang501 commentedNot at the moment. This most likely need more complicated functionality than simple label-value items. I'm leaning to custom js components, similar logic is used by form mode, where common field widgets have their own component. I did have PoC with documentation already made locally to hook external js components, which seemed to work fine. I do not see why it wouldn't be possible with side panel.
While twig rendering could be used, it will lose some interactivity with the Vue app, as you can't hook easily into it externally. I think the correct solution will be hooking external components giving some internal access to app itself.
Related issue: #3603253: Add documentation about how a user can modify/extend the Vue.js app
* I had some hardware issues, so I did not have time to work in these things.
Comment #8
anybodyJust had an idea: Maybe you could at least allow selecting additonal fields from the media entity to show up there or even better add a dedicated view mode for media entities for this?
Having even more possbiities in code is great, but I think showing additional fields from the media entity is the 80% use-case!