Quantcast
Channel: Issues for Drupal core
Viewing all articles
Browse latest Browse all 296357

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

$
0
0

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 #2642122: Overriding already overridden libraries-override requires knowledge of previous libraries-overrides.

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


Viewing all articles
Browse latest Browse all 296357

Trending Articles