Overview

Last updated on
9 March 2022

NOTE: This page is about the Media Library module that is part of Drupal core 8.8 and later. Are you looking for information about the contributed module for Drupal 7?

Media Library is a media management tool that enables you to find media that exists in your site and to add new media items. It allows you to search, sort, and create media items with a robust, easy to use, and customizable interface. It can be used to add media items to an entity reference field, or embed media into your content via a text editor.

Installing Media Library

Getting started with Media Library couldn't be any easier. Simply visit the Extend page of the administrative interface, and install the "Media Library" module from the "Core" group. That's all!

From here, there are two ways to use the Media Library: via an entity reference field, or in a WYSIWYG text editor

Parts of the media library

Parts of the media library, in tabbing order, numbered 1 through 6.

  1. The media library is divided up by media type, and these vertical tabs filter items in the library by type. Which media types, and therefore which tabs, are available can vary depending on site configuration. If you select items on a given tab, then switch to another tab, your prior selections are remembered.
  2. If you have appropriate permissions, this area allows you to add media items to the media library (it does not appear if you don't have permission). Exactly which field(s) will be present in this area can vary by media type and site configuration.
  3. Here you can search for particular media items in the library, or apply various filters to the available items. These filters are part of the "Media library" view, and can be customized as described in "Customizing the media library", below.
  4. The media library can be displayed in two ways: as a grid or as a table. These icons allow you to switch between the two layouts. Any selections you make in the grid layout will be remembered in the table layout, and vice versa.
  5. This is the current set of media items available to you, with filters and/or search terms applied. The media library works a little bit like a shopping cart; clicking the checkbox for any given item will add it to your selection, and you can click the "Insert selected" button to "check out" and add the selected items to a field or text editor.
  6. This counter keeps track of how many media items you have selected so far, across all types. Depending on site configuration, there may be a limit to the number of items you can select, in which case the counter will say something like "3 of 10 items selected". (If there is no limit, the counter will simply say something like "2 items selected".)

Adding media to the library

If you have the appropriate permission, you'll be able to add media to the media library by using the small form directly above the grid (or table) of media items (note that this form does not appear at all if you don't have permission to add media):

The media library, with an arrow pointing to the small form for adding media

When you add media to the library, you will see an interstitial form to fill out additional information. Exactly what information you will need to provide varies by site configuration and by the type of media you're adding. You will at least need to fill out any required fields associated with that media type; if you're adding an image, you will also need to provide alternative text for screen readers. (Some media types, such as YouTube videos, don't require any additional information at all by default.)

Filling out additional required information when adding media to the library

If you had previously chosen items from the media library before you started adding new items, those selections will be remembered; you can see them in the "Additional selected media" area.

When you have finished entering required information, you have two choices:

  • Save and select will save the new media item(s) into the library, then return to it so you can select more items.
  • Save and insert will save your new media item(s) and insert them, along with any prior selections, directly into the field or text editor from which you opened the media library.

Help improve this page

Page status: No known problems

You can: