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

  1. Code-wise I think there should be an alter hook to add further information to this panel or alter existing.
  2. 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?
  3. 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

  1. Discuss
  2. Implement
  3. Test
  4. Release

User interface changes

API changes

Data model changes

Comments

anybody created an issue. See original summary.

anybody’s picture

Title: Allow altering Media details panel contents » Allow altering Media "Details" sidepanel content information
anybody’s picture

If 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?

anybody’s picture

Issue summary: View changes
anybody’s picture

Should we maybe split this task into separate tasks as of the 1-3 list?

anybody’s picture

@ytsurk: Is this already possible?

rang501’s picture

Not 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.

anybody’s picture

Just 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!