Expose Global Variable Within the Control Panel for Selected Site #11082
-
It would be great to expose a global variable to get the “selected site” within the control panel on pages where the multisite site selection dropdown is present, e.g. globals and entry pages where you can select the site from a dropdown. My use case is using this variable to apply style cues to the CP UI based on the selected site based on values stored in global sets. By exposing this variable I can use it to lookup the values of specific global fields based on the selected site as opposed to the current site that I am logged in against.
|
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
As of Craft 4, the selected site will be remembered across CP pages via a I don’t think we would expose that to Twig though, as it would be a little confusing alongside the |
Beta Was this translation helpful? Give feedback.
-
Just added a new Sorry, not sure why it didn’t occur to put it under |
Beta Was this translation helpful? Give feedback.
Just added a new
craft.cp.requestedSite
variable for the next release (needed in order to implement #11303) – 77f87cc.Sorry, not sure why it didn’t occur to put it under
craft.cp
to begin with.