Logo for Media Library Labels

This project is not covered by Drupal’s security advisory policy.

A Media Library field that only accepts one media type still asks editors for
"media". The button says Add media, the empty field says No media
items are selected
, and nothing on screen says whether clicking it will
give you a document, an image or a remote video. Media Library Labels fixes the
wording: on a field restricted to a single media type, the widget says
Add Document and No Document items are selected instead.

Features

  • Relabels the Media Library widget's "Add media" button with the media type
    the field accepts.
  • Rewrites the "No media items are selected" text the same way.
  • Applies only where it is actually correct: fields limited to exactly one
    media type. Fields accepting several types keep core's generic wording,
    which is right for them.
  • Uses the media type's own label, so a type you renamed to "Press photo"
    produces "Add Press photo".
  • Fully translatable — the strings go through t() with the type
    label as a placeholder, so translators keep control of word order.

Use it on any editorial site where content types have several media fields of
different kinds — a document field, a hero image field, a video field. The more
media types a site has, the more the generic label costs in hesitation and in
wrongly uploaded files.

Post-Installation

Nothing to do. There is no configuration page, no permission, no new content
type and no setting. Install the module and every Media Library field that is
restricted to a single media type is relabelled immediately, on every form that
uses the widget.

If a field is not relabelled, it accepts more than one media type: open
Manage fields → the field's settings and check which media types are
ticked under "Reference type". Uninstalling restores core's labels; the module
stores nothing.

Additional Requirements

Drupal core's Media and Media Library modules. No other modules, libraries or
external services.

Similar projects

Media Library
Edit
adds an edit link to items already selected in the widget. It changes
what editors can do; this module only changes what the widget says. Both can be
installed together.

Supporting organizations: 

Project information

Releases