Problem/Motivation
Uncaught PHP Exception InvalidArgumentException: "The configuration property conditions.current_theme.theme.olivero doesn't exist." at ... /core/lib/Drupal/Core/Config/Schema/ArrayElement.php line 76
Steps to reproduce
Select any Theme under "configuration" while trying to save a custom CSS ... apparently the Theme does not exist.
Comments
Comment #2
Carlo commentedComment #3
pookmish commentedBumping this to major. It is a problem with Drupal core 9.5 and 10.0.0. The issue does not exist in Drupal <= 9.4.9.
This seems to be a problem perhaps due to a change in the theme condition plugin schema and/or the ability to choose multiple themes in the condition. By forcing the form to only single theme selection, the form no longer errors.
There might be two solutions to this:
1. alter the schema of the core theme plugin, but only when it's saved in the asset injector config. This would prevent the need for an update hook
2. Keep the schema from core and limit the theme selection to single select. This would likely require a db update to duplicate any assets that have multiple themes configured.
Comment #4
pookmish commentedCaused by #2787529: Missing configuration schema for current_theme condition plugin. It seems that Drupal 9.4.9 didn't actually have any schema for the theme condition plugin which is why there was no failure in the that version or prior. The schema was added 2 weeks ago which also explains why the error didn't pop up sooner in D10 compatibility review.
I will attempt to resolve this in the near future if nobody is able to assist.
Comment #5
pookmish commentedAs it appears, existing assets do not break in their functionality after updating Drupal core. The issue only exists when attempting to save the asset. The solution I think is best would be to present a warning to the user on the edit form for any assets that are configured for 2+ themes. If an asset condition is configured for only 1 theme, no issue exists when saving.
If an asset is configured for two themes, it's the recommendation to duplicate the asset and set the appropriate theme for each asset.
Comment #7
pookmish commentedComment #8
eswiderski commentedThis also happens with 1 theme.
Comment #9
pookmish commentedIt did result in an error when saving with 1 or more themes chosen. There were no errors with any number of themes chosen when simply using the assets (ie no WSOD when viewing your node pages etc). The error only occurred when editing/adding an asset. The latest version of the module should fix the error. Please update to fix the issue.
Comment #10
eswiderski commented@pookmish confirmed, updated to latest release and saves without errors now. Thanks!
Comment #12
aleixJust note that it also happens to me when using config_inspector module and going to /admin/reports/config-inspector:
The configuration property conditions.current_theme.theme.claro doesn't exist.Upgrading as pookmish says and resaving all assets (2 in my case) fixes this.
Also reported in https://www.drupal.org/project/config_inspector/issues/3359846#comment-1...
Comment #13
codebymikey commentedA database upgrade hook would've been ideal here to normalize the asset injector configs which have just a single theme as well as warn users about asset injector entries with multiple themes which needed addressing, removing any manual legwork.
edit: Also, wouldn't it be easier to create an asset_injector condition based on core that supports multiple themes and then migrate across to it similar to #3375026: Provide upgrade path for the "node_type" condition
Example post update hook: