Problem/Motivation
In a scenario with the domain module, domain_config to set default theme differently per domain, themes with declared ckeditor5-stylesheets, and a configured admin theme; Drupal will utilize only one CSS aggregate for both domains.
The AssetResolver::getCssAssets logic to generate the $cid only uses the active theme, which will be the configured admin theme.
$theme_info = $this->themeManager->getActiveTheme();
// Add the theme name to the cache key since themes may implement
// hook_library_info_alter().
$cid = 'css:' . $theme_info->getName() . ':' . $language->getId() . Crypt::hashBase64(serialize($libraries_to_load)) . (int) $optimize;
This $cid value does not account for a default theme's ckeditor5-stylesheets values. Usually, this isn't an issue when there is a single default theme. However, in the case when the default theme can be dynamically set, the $cid and its css will be same and not represent each default theme's ckeditor5-stylesheets values.
Steps to reproduce
- Install multiple themes that utilize different ckeditor5-stylesheets
- Utilize a solution to dynamically set the default theme (e.g. use domain module and domain_config module to set default theme different per domain)
- Create/edit content with formatted text field using ckeditor5 utilizing admin theme with default theme A, observe one set of styles
- Edit same content within dynamic conditions to use the other default theme B, observe the same styles; expect theme B ckeditor5-stylesheets styles
Proposed resolution
- Change $cid to use default theme
Remaining tasks
- consensus on solution
- patch and tests
User interface changes
- none
API changes
- none
Data model changes
- none
Release notes snippet
TBD