Drupal is a registered trademark of Dries Buytaert
Release: Commerce EuPlatesc Payment Gateway 8.x-2.7 Minor update available for module commerce_euplatesc (8.x-2.7). Release: MCP Sentinel 2.13.0 Minor update available for module mcp_sentinel (2.13.0). Release: Myo Theme 1.0.8 Minor update available for theme myo (1.0.8). Release: Commerce Config Actions 1.2.0 Minor update available for module commerce_config_actions (1.2.0). Release: Myo Theme 1.0.7 Minor update available for theme myo (1.0.7). Release: Entity Registry 1.0.5 Minor update available for module entity_registry (1.0.5). Release: Opensolr Search 4.2.0 Minor update available for module opensolr_search (4.2.0). Release: Simple password policy 1.1.4 Minor update available for module simple_password_policy (1.1.4). Module Revived: Comment Notify 8.x-1.6 Module comment_notify updated after 10 months of inactivity (8.x-1.6). Usage Milestone: OpenTelemetry Module opentelemetry crossed 1,000 active installs.

Media replace in media_library_widget adds a Select new
button to existing items in Drupal's Media Library field widget. Editors can
replace a media item directly from the Media Library without removing it
first, while preserving its position in the field.

Features

Drupal's Media Library allows editors to select, add and remove media items
from entity reference fields. However, replacing an existing item normally
requires removing it first and then selecting a new one. This module provides
a direct replacement workflow.

  • Adds a Select new button to every existing media item in supported Media Library widgets.
  • Opens the Media Library in a modal dialog when the button is clicked.
  • Replaces the original media item after the editor selects a new item.
  • Preserves the original field position and item delta.
  • Restricts the replacement selection to the media bundles allowed by the field.
  • Uses Drupal AJAX and the Media Library opener API.
  • Works with Drupal's standard media_library_widget.
  • Also integrates with the media_library_media_modify_widget when the Media Library Media Modify module is installed.
  • Respects normal entity access, field access and form validation.

This module is useful when editors frequently update images, documents or
other media attached to content and need to keep the existing field order
unchanged. Typical use cases include replacing a banner image, updating a
document, changing an event image or updating media in a multi-value field.

Post-Installation

After installing and enabling the module, the replacement button is enabled
by default. It is automatically added to fields using supported Media Library
widgets when those fields contain existing media items.

The module does not create new content types, media types, fields or views.
No additional field configuration is required.

The module provides an optional configuration page at:

Administration > Configuration > Media > Media replacement settings (/admin/config/media/media-replace-media-library-widget)

Administrators can use this page to enable or disable the replacement button
globally. The module only displays the button for existing media items;
empty field slots continue to use the normal Media Library workflow.

Additional Requirements

This module requires:

  • Drupal 10 or Drupal 11.
  • The Drupal core Media Library module.

No additional PHP libraries, JavaScript libraries or contributed modules are
required for the core functionality.

No additional module is required. The module can optionally be used together
with

Media Library Media Modify

when advanced media editing or the
media_library_media_modify_widget is needed.

Similar projects

Drupal core's Media Library provides the standard workflow for adding,
selecting and removing media items from entity reference fields. This module
complements that functionality by adding a direct replacement action for
existing items.

The

Media Library Media Modify

module focuses on editing or modifying media items in context and provides
additional widget options. This project focuses specifically on replacing an
existing media reference while preserving its position in the field.

Supporting this Module

This project is maintained as community-contributed Drupal software. There is
currently no external funding page or sponsorship program for the project.

Community Documentation

Project page:

https://www.drupal.org/project/media_replace_media_library_widget

Community documentation, video walkthroughs and a demonstration site may be
added as they become available.

Additional Information

The replacement functionality was originally developed as part of the
drpl_media module and is now available as a standalone project
for Drupal sites that need a focused Media Library replacement workflow.

The module does not modify media entities directly. It only changes the media
reference stored in the field, using Drupal's standard Media Library,
Entity Reference and AJAX APIs.

Activity

Tracked releases
1
Tracked since
Aug 2026
Latest release
7 hours ago
Releases (12 mo)
1 ▲ from 0
Maintenance
Active

Releases

Version Type Release date
1.0.0 Stable Aug 25, 2026