Problem/Motivation

Now that admin paths are part of route definitions:

Option A) ... it would be super useful to have an "Is administrative path" condition plugin in core!

The use-case is not to use path conditions like

admin/
admin/*

for cases where conditions are used.
This check isn't really feature-complete for admin paths and kind of ugly. So frequently you end up with something like

/admin
/admin/*
/batch
/node/add*
/node/*/*
/user/*/*
/user/login
/user

...

A bonus would be to also be able to match paths that are shown in the admin theme, based on the theme settings checkbox, for example node edit forms.

Option B) The current workaround is to use "Current theme" = "Gin" (Name of the admin theme)
An alternative to the suggested approach would be to add generic options to the "Current theme" condition:

  • <Default Theme>
  • <Administration Theme>

Conditions like this are frequently used for Blocks, Analytics modules, Contexts, etc. that should only act in the frontend, but never on admin pages.

Would be nice to discuss, which solution is the core maintainers favourite, before we start with the implementation.

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

Introduced terminology

API changes

Data model changes

Release notes snippet

Issue fork drupal-3482723

Command icon 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

anybody created an issue. See original summary.

anybody’s picture

Looking forward to your feedback! :)

anybody’s picture

Issue summary: View changes
anybody’s picture

Issue summary: View changes

anybody’s picture

Furthermore, I just saw that currently it doesn't seem to be possible to select NO theme in this condition (ignore the condition). So if using "ALL", once saved, the condition is always applied! I found this issue for that: #2783897: Current theme condition plugin should provide an option to match all themes and introduce checkboxes

Version: 11.x-dev » main

Drupal core is now using the main branch as the primary development branch. New developments and disruptive changes should now be targeted to the main branch.

Read more in the announcement.