Theme library override can fail in when you have multiple parent themes

Created on 6 August 2019, over 5 years ago
Updated 17 July 2024, 7 months ago

Problem/Motivation

When you have a complex setup of a couple of themes that are inheriting each other, something like:

theme_1 <- theme_2 <- theme_3 <- client_theme

where theme_1 is the starting base theme, and each theme is overriding various libraries from parent themes library override definitions can fail when multiple themes are overriding the same library.

In LibraryDiscoveryParser::applyLibrariesOverride() next call on line 339

$all_libraries_overrides = $active_theme->getLibrariesOverride();

Will return array of library overrides for all themes but in the wrong order, like

[
  'theme_3' => [...],
  'theme_2' => [...],
  'theme_1' => [...],
  'client_theme' => [...],
]

The correct order would be

[
  'theme_1' => [...],
  'theme_2' => [...],
  'theme_3' => [...],
  'client_theme' => [...],
]

As a consequence of this wrong order applyLibrariesOverride() can and will fail for libraries that are overridden for example in theme_1 and theme_3 because override is applied in the wrong order. Order is important for now because of 🐛 Overriding already overridden libraries-override requires knowledge of previous libraries-overrides Needs work .

Proposed resolution

Active theme libraries-override array should respect theme inheritance order and have parent themes in the correct order.

Remaining tasks

  • Figure should we fix some other definitions also like 'libraries' because they are also in the wrong order. Maybe this affects the loading of resources in the wrong order?

User interface changes

None.

API changes

None.

Data model changes

None.

Release notes snippet

🐛 Bug report
Status

Fixed

Version

11.0 🔥

Component
Theme 

Last updated about 21 hours ago

Created by

🇷🇸Serbia pivica

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

Merge Requests

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

Production build 0.71.5 2024