Problem/Motivation

FormHooks::formMediaLibraryAddFormAlter() (core/themes/default_admin/src/Hook/FormHooks.php:188) attaches default_admin/media_library.theme to the Media Library add form, but default_admin.libraries.yml defines no such library (it has media_library).

The name is left over from Claro, which defines claro/media_library.theme (claro.libraries.yml:299). Default Admin's Media Library CSS comes in through libraries-extend (default_admin/media_library) instead, so the attachment does nothing.

Proposed resolution

Remove the attachment.

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3628096

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

d34dman created an issue. See original summary.

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

shank115’s picture

Status: Active » Needs review
dcam’s picture

Version: 12.0.x-dev » main
Issue summary: View changes
Status: Needs review » Reviewed & tested by the community
Related issues: +#3590364: Part 2 of Consolidate, refactor, remove and untangle Claro's CSS from Default Admin theme

The default_admin libraries related to media_library were reorganized by #3590364: Part 2 of Consolidate, refactor, remove and untangle Claro's CSS from Default Admin theme. That was when the media_library.theme library was consolidated into the single, unified asset library.

I checked to see if there are any other lingering references to the old asset library and didn't find any. I also grepped for the other consolidated library name, media_library.ui, and didn't find any of those either. I think the attachment being deleted by the MR is the only remaining reference in Core.

Obviously, the attachment currently does nothing since the library doesn't exist. But I verified the assertion in the issue summary that the CSS is added via a library extension:

  1. Add a content type with a media reference field for images.
  2. Visit the node add form for the content type.
  3. Verify that these CSS files are attached to the page:
    • /core/themes/default_admin/css/components/media-library.css
    • /core/themes/default_admin/css/components/media-library-item.css
    • /core/themes/default_admin/css/components/media-library-vertical-tabs.css

The CSS files are attached to the form, indicating that the library extension is working as expected. Therefore, it's correct to delete the attachment in the form alter hook rather than repairing it.

catch’s picture

@shank115 it looks like you used an LLM to generate the MR (going by the MR summary), which I'm a bit confused by because it would take less key presses to delete the line manually than prompt an LLM to do it. Please note Drupal's contribution policy which requires disclosure of LLM usage when contributing to Drupal https://www.drupal.org/docs/develop/issues/issue-procedures-and-etiquett...

  • catch committed 581a3bd7 on 12.0.x
    fix: #3628096 Default Admin attaches a library it doesn't define
    
    By:...

  • catch committed ad11ba71 on main
    fix: #3628096 Default Admin attaches a library it doesn't define
    
    By:...
catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to main and 12.0.x, thanks!

Now that this issue is closed, review the contribution record.

As a contributor, attribute any organization that helped you, or if you volunteered your own time.

Maintainers, credit people who helped resolve this issue.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.