Problem/Motivation

It is currently not possible to change the width and height of the media library modal. The values are hard-coded (in MediaLibraryUiBuilder::getDialogOptions()) and not changeable.

In #3127867-7: MediaLibraryWidget should use the media_library.ui_builder service when fetching modal dialog options, @seanB said:

I've had more questions about changing the width and height of the modal. We have discussed things like an alter hook before but since the class is also used in a lot of javascript we should not make it easy for people to change this.

As a first step I can see making this method non-static and fetch the options via the service is a good step to help with this. Calling the static method on the class is definitely not developer friendly. I guess if we make the width and height configurable this would even help other people from not needing to override the service as well, but that can be a followup.

This is that follow-up.

Steps to reproduce

N/A

Proposed resolution

Make the dimensions configurable in some way -- ideally as settings of the Media Library field widget.

Remaining tasks

Write a patch with tests
Review and commit

User interface changes

TBD; possibly a couple of new configuration options for the Media Library field widget.

API changes

None.

Data model changes

The Media Library field widget may get a couple of new settings.

Release notes snippet

TBD

Issue fork drupal-3167992

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

phenaproxima created an issue. See original summary.

phenaproxima’s picture

Version: 9.1.x-dev » 9.2.x-dev

Drupal 9.1.0-alpha1 will be released the week of October 19, 2020, which means new developments and disruptive changes should now be targeted for the 9.2.x-dev branch. For more information see the Drupal 9 minor version schedule and the Allowed changes during the Drupal 9 release cycle.

mkimmet’s picture

This would be really helpful functionality, as a bigger window size would make interacting with the media library easier.

Version: 9.2.x-dev » 9.3.x-dev

Drupal 9.2.0-alpha1 will be released the week of May 3, 2021, which means new developments and disruptive changes should now be targeted for the 9.3.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

mrpauldriver’s picture

I'd be keen to see this happen.

There is a lot of space around the modal which could be put to good use improving the UX of the media library.

phenaproxima’s picture

There is already an issue for this to be done in Media Library Extras: #3228196: Make it possible to configure the width and height of the media library

That issue is basically ready from a code perspective, but it needs someone to review and ideally manually test it before it can be committed.

Version: 9.3.x-dev » 9.4.x-dev

Drupal 9.3.0-rc1 was released on November 26, 2021, which means new developments and disruptive changes should now be targeted for the 9.4.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

seanb’s picture

Status: Active » Needs review
StatusFileSize
new4.09 KB

Attached patch makes the MediaLibraryUiBuilder::dialogOptions() method non-static which would allow the settings to be overridden by decorating the UI builder service.

ranjith_kumar_k_u’s picture

StatusFileSize
new4.37 KB
new642 bytes
new4.37 KB
new642 bytes
ranjith_kumar_k_u’s picture

The last submitted patch, 10: 3167992-10.patch, failed testing. View results

Status: Needs review » Needs work

The last submitted patch, 10: 3167992-10.patch, failed testing. View results

Version: 9.4.x-dev » 9.5.x-dev

Drupal 9.4.0-alpha1 was released on May 6, 2022, which means new developments and disruptive changes should now be targeted for the 9.5.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 9.5.x-dev » 10.1.x-dev

Drupal 9.5.0-beta2 and Drupal 10.0.0-beta2 were released on September 29, 2022, which means new developments and disruptive changes should now be targeted for the 10.1.x-dev branch. For more information see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

Version: 10.1.x-dev » 11.x-dev

Drupal core is moving towards using a “main” branch. As an interim step, a new 11.x branch has been opened, as Drupal.org infrastructure cannot currently fully support a branch named main. New developments and disruptive changes should now be targeted for the 11.x branch, which currently accepts only minor-version allowed changes. For more information, see the Drupal core minor version schedule and the Allowed changes during the Drupal core release cycle.

jorgik made their first commit to this issue’s fork.

aasarava’s picture

StatusFileSize
new1.76 KB

Rerolled patch to work with Drupal 10.3.x.

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.