Problem/Motivation
Currently, it is not possible to exclude the "current_theme" condition from evaluation. Though the select list with themes is not marked as required, the user is always bound to select some theme because there is no "empty" option, which leads to incorrect evaluations
For other condition plugins, this is possible. For instance, for the node bundle plugin you can uncheck all content types, so that the condition will always evaluate to TRUE.
Steps to reproduce
- Edit a form which uses a Condition Plugin Instance inside their form (Only instance in core would be BlockForm, but there the condition is manually unset, so it needs to be manually set IN CODE again before testing => Comment out line 235-237 in "core/modules/block/src/BlockForm.php").
- Adjust any conditions as you like (apart from Current theme).
- Save the form.
- The first listed theme was selected automatically and the block (or whatever you tested it on) will only be displayed when using the selected theme (even if you haven't selected it yourself)
Proposed resolution
Use checkboxes instead and allow the user to select the themes he wants the condition plugin instance to evaluate to TRUE. This way the negate option also makes way more sense and the user can allow all themes simply through unchecking all checkboxes.
Remaining tasks
User interface changes
Before:

After:

Introduced terminology
API changes
Data model changes
Release notes snippet
| Comment | File | Size | Author |
|---|---|---|---|
| #100 | screenshot-2026-04-07 17_16_22.png | 10.14 KB | grevil |
| #100 | screenshot-2026-04-07 17_05_36.png | 7.48 KB | grevil |
| #78 | screenshot-2025-10-27 16_16_15.png | 11.93 KB | grevil |
| #39 | current_theme_google_tag.png | 82.49 KB | eduardo morales alberti |
| #37 | interdiff_31_37.txt | 1.93 KB | eduardo morales alberti |
Issue fork drupal-2783897
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments
Comment #2
chi commentedComment #3
chi commentedI consider this as a bug.
Comment #5
bucefal91 commentedHello, Chi :)
The #3 patch no longer applied cleanly, so I rerolled it.
Additionally, I think a more elegant way to introduce that "Any" option would be via
#empty_optionproperty on the select element. So I did in my patch.Comment #13
albeorte commentedI've adapted the patch code to be compatible with Drupal 9.2.x
Comment #16
andregp commentedFixed typo that triggered the test fail and rephrased some sentences.
Ps.: This patch applies for 9.2.x, 9.3.x, and 9.4.x
Comment #17
andregp commentedAdded test coverage for the '- Any -' option and also added period to all sentences to keep consistency.
Comment #19
eduardo morales albertiCommitted to the merge request the changes made by andregp
Comment #20
albeorte commentedComment #21
smustgrave commentedTagging for framework input. If this is a path we want to go down.
Comment #22
smustgrave commentedThis issue is being reviewed by the kind folks in Slack, #needs-review-queue-initiative. We are working to keep the size of Needs Review queue [2700+ issues] to around 400 (1 month or less), following Review a patch or merge request as a guide.
Think it will help for steps to reproduce this bug.
With a UI change before/after screenshots should be added to the issue summary.
Comment #23
eduardo morales albertiThe current theme condition is not shown on blocks because of:
https://git.drupalcode.org/project/drupal/-/blob/10.1.x/core/modules/blo...
Should we recover this condition?
It was removed on https://www.drupal.org/project/drupal/issues/2339151
Comment #24
eduardo morales albertiWe are changing the plugin because of https://www.drupal.org/project/google_tag/issues/3263122, to be able to load the google tag on any theme, and recover this plugin on the module. Now is excluded because is not possible to select any theme.
Comment #25
eduardo morales albertiUpdated to apply to the last drupal version
Comment #27
eduardo morales albertiComment #28
eduardo morales albertiAdded patch also and diff between last commit and the current one, allowing blocks to use the current theme condition.
Comment #29
eduardo morales albertiAdded steps to test and captures as asked by @smustgrave
Comment #30
eduardo morales albertiI will review the failed tests https://www.drupal.org/pift-ci-job/2710393
Comment #31
eduardo morales albertiFixed tests, ready to review
Comment #32
smustgrave commentedI think the test coverage is okay.
But found the workflow a little odd.
I did a Standard install
Went to block layout
Added a block under the Olivero tab but have it only appear on the claro theme.
Tagging for usability for that
Now if we had a global block layout tab then this setting would make sense I think.
Will leave in review for framework manager thoughts.
Comment #33
eduardo morales alberti@smustgrave Do you think the options should be "current theme tab" or "any" in the case of block layout? instead of the list of all themes.
For the block layout, it have sense because it has theme tabs, for other cases, the list should have all themes
Comment #34
lauriiiCould someone expand the issue summary to explain why is this setting needed? Drupal Block UI is built so that blocks are intended to be specific to a theme. If we want to change that, it would be helpful to understand why that's desired.
Comment #35
eduardo morales alberti@lauriii You are totally right, I miss the original scope of the issue.
We use current theme condition on google_tag module, but we need the "- any -" option https://www.drupal.org/project/google_tag/issues/3263122 to have the ability to use google_tag on all themes or only on a theme.
For blocks the current_theme condition does not have any sense at all, I will remove the logic that I changed related with blocks and update the summary.
Comment #36
eduardo morales albertiComment #37
eduardo morales albertiAdd MR changes as patch
Comment #38
eduardo morales albertiSeems like the block is the only drupal core entity that uses the "plugin.manager.condition", and the current theme is excluded in this case as explained in previous comments so in the example I will use the google_tag scenario.
Comment #39
eduardo morales albertiComment #40
eduardo morales albertiComment #41
yoroy commentedWhy a select list here when all the other variations of this use checkboxes?
Comment #42
larowlanwe can return early here and avoid using else
This feels like a UX WTF?
How can a current theme not be one of the enabled themes?
So as such I think we probably want to prevent the negate option when 'Any' is selected
Nice work folks
Comment #43
smulvih2#37 works for me on 10.2.2
Comment #44
anybodyJust ran into this when working on #3482723: Create an admin route condition plugin or add generic "Current theme" options for admin and default theme and I think we should rate this as major issue, because currently once you saved the conditions, this condition is always added and evaluated and user has no way to disable this rule! This leads to wrong and unexpected condition results!
So the DROWL team will push things forward here very soon, as it affects us in multiple projects. :)
Comment #45
anybodyComment #46
anybodyOne important addition: The form element should be checkboxes, not radio!
It makes no sense to force selecting only one theme!
Selecting no theme at all should always evaluate to TRUE!
I wonder how this ever made its way through core reviews. The condition neither has sufficient UX, nor works technically well... we should get this fixed ASAP!
Comment #49
grevil commentedOk, I adjusted the code, so that we now use checkboxes instead of the select. As @anybody and @yoroy already mentioned, this makes much more sense UX wise.
The only problem is, that this change requires an update hook, as we can now select multiple themes instead of only one. But I can't seem to find a good way on how to update a condition configuration, as it usually just gets merged into the form it was used. @larowlan do you know of a good way on how to update all form configs using the condition? If not, we could alternatively leave the "theme" config in as a fallback (simply wrapping an array around it) and deprecate it. Although I am not super keen to do so...
Anyway, apart from the update hook this can go back to "Needs Review", note that I did a total rewrite, so this needs to get reviewed throughout again.
Comment #50
grevil commentedComment #51
anybodyThanks @grevil totally makes sense and code LGTM so far. Sadly, I have no clue, how an update hook for a condition plugin can be written to work globally. I'm also unaware of any existing examples, while I think they possibly exist.
Is there maybe any core maintainer or someone else experienced with that? We'd really like to finish this, for UX and bugfixing reasons, as currently it's kind of broken by design ;)
Comment #52
rkolleri saw the needs usability review tag, and we can put the issue on the shortlist for the meetings on friday. but only one question, i've tried to quickly test the MR on 11.x now, but i have a hard time to see any actual change in the ui. the proposed resolution section in the issue summary is not very clear, i then tried to follow the instructions in #32, but again i see nothing in the ui of a block configuration page on a block layout page enabling me to choose a theme (nothing theme related in the vertical tabs nor in the select for the region - and i ran an
drush updatedbas well as adrush cr).Comment #53
anybody@rkoller thanks, yes that's because this condition plugin doesn't seem to be applied on blocks, if I remember correctly.
We ran into this in contrib modules that allow all condition plugins, e.g. https://www.drupal.org/project/posthog or https://www.drupal.org/project/context - unsure if there's also a place in core where it's shown.
@Grevil can you please update the IS accordingly by time, if I'm right?
Comment #54
grevil commented@anybody I updated the IS just yesterday:
I will add the info, that it needs to get manually set IN CODE, together with the line.
Comment #55
rkollerthe update to the issue summary helped, i am able to reproduce and test now. thanks a lot for the updated instructions @grevil!
Comment #56
godotislateDoes there need to be a BC layer for the old
themeproperty? I think this might be especially tricky because I don't think there's anything in core that uses this condition plugin's configuration, so there's nothing to write update hooks. Contrib/custom will have to write to own update hooks as needed, most likely.Comment #57
grevil commentedOk, I will prepare everything to declare "theme" deprecated. Thanks for your feedback!
EDIT: I created a CR draft: https://www.drupal.org/node/3523553
Comment #58
grevil commentedAlright, that should be it!
Comment #59
godotislateI made suggestions to handle translating the value to "themes" in the form and deleting in the submit, but I forget about translation at runtime. I'm not sure how this can be done, since I'm not sure how to know which property/subproperty in a config entity would correspond to this. And similarly outside of the form submit, how can the property be identified in a config save?
Separately, it might make sense to create a follow up to add constraints to the config schema for the new property, reusing the ExtensionAvailable work in #3432353: Add validation constraints to core.extension once that's in.
Comment #60
larowlanLeft a review
Comment #61
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #62
grevil commentedOk adjusted everything accordingly! For some reason the KernelTests time out. I had a similiar issue in another core issue. Should be hopefully fixed with the next rebase.
Comment #63
anybodyThanks @grevil - the broken test persists, no idea why. I just rebased it with latest core. Maybe look into other core MR's and check differences first?
Comment #64
grevil commented@anybody! Nono, this is a success! The tests now actually show failures! Before it simply timed out after 1 hour.
Comment #65
grevil commentedAll green now, finally! Ready for final review!
Comment #66
anybodyWhao, GREAT @grevil, tests are also green now!
I'll review this very soon. Unclear if this still Needs usability review? I think it's 10000x better than before, which really was misleading and bad ux :)
Totally fine and expected UX-wise from my perspective.
Thank you!
Comment #67
anybodyCode-wise LGTM and works as expected, has tests, what else do we want :)
Finally I just left some comment questions asking if we should add a consistent
@deprecatedcomment everywhere "theme" is still present in code, so that it can be easily and consistently removed in D12 or would that just bloat the code?Settings this RTBC anywhere for the maintainers etc. to look into this and decide.
Thank you all!
PS: I'd also still consider this a major UX bug, just like @chi in #3. From my perspective, the condition was not really usable.
Comment #68
catchGiven we don't know where this might be used, and those places will need to write an upgrade path, I think the deprecation should be for removal in Drupal 13.
Comment #69
grevil commentedAlright, that should be it!
Please review!
Comment #70
grevil commentedSince we haven't heard anything from @rkoller since #55, I guess we can remove the "Needs usability review" tag?
The only place this is used is in block, and there it is unset, because it is completely unusable in its current state.
Comment #71
anybodyNice, thank you Grevil! Thanks for also adding the other deprecation notices.
@catch is that fine?
Comment #72
quietone commentedTrying for a better title.
There is a failing test, Current theme condition plugin should provide an option to match all themes and introduce checkboxes
Comment #73
grevil commentedSorry, forgot to message the expected deprecation messages inside the tests. Should be green now!
Comment #74
grevil commentedYes, all green again.
Comment #75
anybodyYes
Comment #76
rkollerUsability review
We discussed this issue at #3552911: Drupal Usability Meeting 2025-10-24. That issue will have a link to a recording of the meeting.
For the record, the attendees at the usability meeting were @rkoller, @simohell, and @the_g_bomb
At first apologies, I remember we've tried to review this issue back in #3522326: Drupal Usability Meeting 2025-05-09 but had issues reproducing and getting to the gist of the problem. We agreed on asking in here for clarification. But somehow no one of us has actually commented on the issue back then. :( Sorry again. :(
About two weeks ago I've noticed in my inbox that I got referenced in comment #70 by @grevil. I am "a bit" swamped in recent weeks so just got to revisiting the issue in todays meeting. We were able to navigate around the previous stumbling block and were able to review it. A few observations:
So in summary we would have the following recommendations:
Show for the selected themesandHide for the selected themesand move the radio button before the list of checkboxes for the available themes. The description would become obsolete cuz the radio button labels would be self explanatory and clear from our perspective. In case a radio button would be impossible for this plugin or that step should be moved to a follow up then replace the descriptionSelect the themes this condition should evaluate TRUE on.withShow for the selected themesfor nowComment #77
grevil commentedThank you, @rkoller! Back to "Needs work" to implement the recommended usability adjustments.
Comment #78
grevil commentedAdjusted the description accordingly. It now uses a similiar description to the "language" condition plugin.
This one is trickier than I thought. I have no idea, where this is defined in the condition plugin. I looked at other plugins but still no idea...

Interestingly enough, the "Vocabulary" condition has the same problem:
EDIT: Ok, this is WILD, the summary is defined inside "core/modules/block/js/block.js"... that should definitely NOT be the case, since this logic should be part of the condition plugin and NOT bound to the block module. Also, worth for another follow-up issue
This should be fixed in a general issue for all conditional plugins, since ALL of the use the same pattern:
Applied first
Negate second
you simply can not see it, since Blockform disables negation for all other condition plugins in line 253-265 of "BlockForm":
Same here, we should create a central follow-up issue for this as well. Since the "negate" behavior is baked in code through "ConditionPluginBase" "isNegated()" method:
This is not covered in the MR / Patches of [#14640540]. Therefore, I'd leave it as is for now.
I hope this is ok as is. Please review.
Comment #79
grevil commentedOk, edited my other comment. Should be all fine now.
Comment #80
anybodyThank you for the final improvements @grevil!
I agree that the checkbox vs. radio change should better be done everywhere consistently in a separate issue and not further block this. Of course, I totally agree with the UX improvement.
Thank you, RTBC! @rkoller and @quietone would you have a final look if all is fine for you now?
Comment #81
rkollerI left a suggestion on the MR in regard the wording. keeping the string in line with the one for the language plugin is a good call. i wasnt aware that you are able to unhide that plugin as well.
in regard of the summary, yep we noticed the missing summary on the vocabulary tab as well. we would open a followup issue for that in case no one else beats us to it. but for the current theme we just thought if it would be easy to add then do the adding in the scope of this issue for the sake of consistency, otherwise also as a follow up.
in regard of the order and the radio buttons i agree. that is what i tried to express. in contrast to the summary those two bits introduce sort of "new" approaches so it would hold back the issue.
Comment #82
anybodyThanks for the rapid feedback @rkoller! I went ahead and fixed it, also fixed the return type issue. Please check if both is fine now, if tests are green.
Will you create the related / follow-up issues?
Comment #83
anybody@grevil: You forgot to fix the tests accordingly. Please do so, I gave some examples... still WIP / NW
Comment #84
grevil commented@anybody, why have you removed the PluralTranslatableMarkup return type?
The "response_status" condition plugin has the exact same return type.
Comment #85
anybodyTests were failing here, see my commit message. Maybe you looked into a different core version or something...? After removing, all was fine again.
Comment #86
grevil commentedOk, I am now using the "starterkit_theme" instead of the "test_theme", since its label is wrapped in strong tags for some reason.
Also adjusted the summary logic slightly, to support the old deprecated "theme" config key.
Please review once again!
Comment #87
anybodyThanks for fixing the tests with the new texts! :)
@rkoller: All fine now?
Comment #88
rkolleri havent had the chance to test another time. but looking at the commits all the changes since i last looked were about code related issues and tests. so i most likely havent anything else to add, and in regard to your question in #82 i have not enough time and focus at the moment. currently completing a course which is heavy on assignment. i have currently dialed back everything in regard to contributions, the friday's ux meeting is the sole thing i do in recent weeks. i wouldnt be sad, rather thankful, if anyone else beats me to opening those follow ups or otherwise i will do that after that course is over at the end of november. and in case someone already opened the followup i will catchup and add to those then there.
Comment #89
catchSince @lauriii asked for more details on why this was needed in 2023, tagging for product manager review to make sure that question is sufficiently answered.
Comment #90
anybodyThanks @catch! Yes would be great to finally get this fixed and finished. It was simply broken by design all the time... but rarely used I think, so that was barely visible, at least in core.
Comment #92
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #93
anybodyRebased
Comment #94
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #95
anybody@grevil: We have failing test, could you have a look again?
When will the product manager have a look at this presumably?
Comment #96
grevil commentedI removed the expectation of an deprecation error entirely, as there were a lot of new unrelated deprecation errors and IMO it doesn't make sense to check for 10+ deprecation errors inside a test where only 1 is relevant for the test in place.
Comment #97
anybody@grevil agreed!
Comment #98
grevil commentedAll green again!
Comment #99
gábor hojtsyPlease post before / after screenshots to help evaluate what is being changed on the UI.
Comment #100
grevil commentedAdded them to the issue summary.
Comment #101
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It no longer applies to Drupal core. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #102
anybodyComment #103
anybody@godotislate do you have the required permissions to set the GitLab comments resolved that are resolved?
Are we able to finally get this fixed?
This is still entirely blocking the usability of the theme condition.
Thank you!
Comment #104
penyaskitoMinor test coverage issue in https://git.drupalcode.org/project/drupal/-/merge_requests/4331#note_747105.
IMHO we should remove
#[IgnoreDeprecations]and create a specific test for the old way, which would be the only one tagged with#[IgnoreDeprecations]and should use$this->expectDeprecationComment #105
grevil commented@penyaskito, great idea! I split the test accordingly, rebased the issue branch to current main and set the deprecation version to 12.0.0 (both in the deprecation message and the change record). The last step was done, because current main should be on par with Drupal 12 I think?!
When everything is green, we should definitly start merging this, as the theme condition is currently unusable otherwise.
Please review!
Comment #106
needs-review-queue-bot commentedThe Needs Review Queue Bot tested this issue. It fails the Drupal core commit checks. Therefore, this issue status is now "Needs work".
This does not mean that the patch necessarily needs to be re-rolled or the MR rebased. Read the Issue Summary, the issue tags and the latest discussion here to determine what needs to be done.
Consult the Drupal Contributor Guide to find step-by-step guides for working with issues.
Comment #107
grevil commented@penyaskito can I put the status back to RTBC? I really don't want to delay this any further...
Comment #108
grevil commentedAh sry, tests fail.
Comment #109
grevil commentedAll green again! I only adjusted the tests, so this should be good to go again!
Comment #110
anybodyThanks for the fix @grevil! Back to RTBC! Let's get this one fixed!
Comment #111
alexpottComment #112
alexpottIt looks like we need a follow to properly implement \Drupal\Component\Plugin\DependentPluginInterface::calculateDependencies() for this plugin as it's not adding the theme as a dependency.
Comment #113
grevil commentedAdjusted accordingly.
I'll create a follow-up issue, once this is merged. Thanks for the review @alexpott! Should "hopefully" be good to go now!
Comment #114
grevil commentedCreated the follow-up issue here: #3590591: Implement "DependentPluginInterface::calculateDependencies()" for the "CurrentThemeCondition" .
Comment #115
anybodyAll green again, LGTM. Thanks @grevil! Thanks also for the follow-up!
Comment #116
longwaveWhile we've got BC and a
trigger_errordeprecation, what happens to existing config that uses the old storage format? Site builders generally do not see deprecation messages, and even if they do see 'The "theme" configuration key is deprecated in drupal:12.0.0 and will be removed in drupal:13.0.0. Use "themes" instead.' neither the message nor the change record tell them what to actually do to fix this problem. I think they just have to re-save any affected config? But if they don't, then this will silently break in Drupal 13 when we remove the BC layer.We could have an update hook that saves all affected block config for example - but note also that the condition API could be used elsewhere in other config entities, and I'm not sure how to solve this.
Comment #117
godotislateBlocks don't actually use the condition. It's removed from the block form and there are no settings for it saved to block configuration AFAICT. I believe there is no use of the
current_themecondition plugin in core other than tests.