Drupal 11.1 removes unintended usage of hook_library_info_build() by themes.

Created on 28 March 2025, 20 days ago

Problem/Motivation

Prior to 11.1, hook_library_info_build was unintentionally usable by themes to define libraries dynamically. The specific change is apparently https://www.drupal.org/node/3442349 . See https://api.drupal.org/api/drupal/core%21lib%21Drupal%21Core%21Render%21... for documentation showing only Modules were intended to use this hook. Currently Adaptivetheme Subthemes generated by AT Tools starterkit use hook_library_info_build() to define the theme's layout and extension libraries dynamically. Upon upgrading to Drupal 11.1, these hooks will no longer be called and all dynamic libraries for layout/extensions will fail to be defined.

Steps to reproduce

Upgrade site using any adaptivetheme subtheme to Drupal 11.1.

Proposed resolution

Reroll our implementation of hook_library_info_build to use hook_library_info_alter.

Remaining tasks

🐛 Bug report
Status

Active

Version

3.1

Component

Code

Created by

🇺🇸United States redeight

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @redeight
  • 🇺🇸United States redeight

    Unfortunately, this change will likely need to be rolled manually by everyone currently using any subtheme generated prior to us fixing this since those subthemes will use the incorrect hook.

  • 🇺🇸United States redeight

    For those looking for a quick fix using a generated subtheme:

    1. Replace function HOOK_library_info_build() { with function HOOK_library_info_alter(&$libraries, $extension) {.
    2. Remove the line that says $libraries = [];
    3. Remove the line that says return $libraries;

    That should get your layout and extension libraries working again.

  • 🇮🇹Italy arturopanetta Grotteria (RC)

    Thanks @ I fixed boostrap_italia theme with your solution https://www.drupal.org/project/bootstrap_italia/issues/3501035 🐛 Drupal 11.1 breaks theme Active

Production build 0.71.5 2024