Idea needed to work around limitations of "when" Condition


I want to display a note in the panel of a project when it is running on the Production System. As a warning, because in the heat of the moment I like to mix up open tabs :wink: So I want to show the Production warning in green, the Development warning in red.

Unfortunately the value of “theme” can’t be set e.g. via pure site-method.

My idea: I put in site.yml 2 info fields. One with the theme positive, one with the theme negative and hide the not matching one, depending on whether I am on the production system or a test url.

I then created a site method that returns the appropriate info (DEV or PROD). I wanted to write this info into another field and simply hide my two info fields with the “when” condition.

But: I can’t set the value. “When” seems to work only when the user makes a manual selection. “Default” works only at creation, so it can’t be dynamic. The whenQuery plugin doesn’t help either.

Am I missing something, is there no way to solve this as simple as thought? Does anyone have a good idea? :slight_smile:

Idea: Use a custom theme and set the css for it as custom panel css based on env value, see also

i would set a different custom css for the panel for each config and style like the black head in the panel differently.


.k-topbar, .k-topbar-signals, .k-topbar-wrapper:after {
  background-color: #bada55;



return [
    'panel' => [
        'css' => 'assets/css/panel-staging.css',
    // .. other options

Thank you very much - top idea and insanely fast answer. Great community!

I was trapped in my idea of a yml + PHP only solution. Nice to think out-of-the-box :slight_smile: