Before #3087456: Move some representational classes in Media Library to Classy and others to Seven and/or Claro, as appropriate, the media library was not heavily themeable.
That issue adds some theme extension points, via several "suggestions" of existing themes, and two completely new theme hooks/templates.
media-library-wrapper.html.twig
This is the "wrapper" of the entire media library, as it appears in the modal dialog. It has two variables by default: menu
, which is the menu of available media types; and everything else, under the content
variable.
media-library-item.html.twig
This is a particular piece of media selected in the media library. It is used in two places:
- When using the media library field widget, this will be used to render each media item already selected in the field. A button to remove the item from the field will be prepended above it, and a JavaScript-toggled numeric weight field will be appended after it. This usage can be specifically targeted by themes using the
media-library-item--widget.html.twig
template. - When Media Library's "advanced UI" is enabled, this will also be used to render each media item in the "Additional selected media" area that is displayed when adding new media in the modal dialog. In this case, a checkbox to remove the item from the selection will be prepended above it. This usage can be specifically targeted by themes using the
media-library-item--small.html.twig
template.