DrQuincy Posted November 12, 2021 Share Posted November 12, 2021 I have had a client say that because the dev and live hosts are so similar they get confused between the development and production CMSs. They have asked for a way to make it clearer which environment they're in. Although it says “The site is in debug mode, suitable for sites in development” in yellow when you log in on the dev version I think they are wanting something more obvious. An easy solution would be to add a message at the top of the page in debug mode. After messing around with Inspect element it seems if I could insert custom HTML before div#pw-mastheads that would do the trick. Is there a hook for this? I could do it with custom JS but is there any way to tell from the DOM or an existing JS variable if it's in debug mode? Thanks. Link to comment Share on other sites More sharing options...
DV-JF Posted November 12, 2021 Share Posted November 12, 2021 Hey @DrQuincy in site/templates/admin.php you could do somthing like this: <?php $wire->addHookAfter('AdminTheme::getExtraMarkup', function(HookEvent $event) { $parts = $event->return; $markup = ''; if((wire('config')->debug) == true) $markup = ' <div class="pw-container uk-container uk-container-expand"> <div class="uk-alert uk-alert-danger">Your in Debug Mode!</> </div>'; $parts['masthead'] .= $markup; $event->return = $parts; });?> Perhaps you could even check the $config->httpHosts if you want to. I hope this'll help you ? Many greets! 4 Link to comment Share on other sites More sharing options...
DrQuincy Posted November 12, 2021 Author Share Posted November 12, 2021 Wow, that is just what I needed! Thanks so much! Link to comment Share on other sites More sharing options...
MarkE Posted November 12, 2021 Share Posted November 12, 2021 My solution to this has been simply to add a warning in ready.php. The solution above looks neater though, and not dismissible (which may be a good or bad thing). 1 Link to comment Share on other sites More sharing options...
DrQuincy Posted November 15, 2021 Author Share Posted November 15, 2021 That's a nice simple solution. I'd probably use that for myself but in this instance the client wanted something more obvious. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now