Jump to content

How to disable the debug bar from within an url hook?


bernhard
 Share

Recommended Posts

Hey @adrian I have this hook in place:

$wire->addHookAfter("/foo", function () {
  return "foo";
});

And the page shows "foo" as expected. But it also shows the debug bar and I did not find an easy solution for disabling it... Is there (or could there be ? ) something like this:

$wire->addHookAfter("/foo", function () {
  $this->wire->tracy->noBar = true;
  return "foo";
});

 

Link to comment
Share on other sites

Hey @bernhard,
the "disable tracy" button in the debug bar is invoking a js method "disableTracy()" which does this:

function disableTracy() {
      document.cookie = "tracyDisabled=1; expires=0; path=/";
      location.reload();
}            

Maybe you can then, in your hook url, use the WireHttp:setCookie() method and do the same as above?

Let me know :)

Link to comment
Share on other sites

Thx, that works!

I'm working on my pagebuilder and have a mobile preview where the debug bar is a little disturbing I guess. But I might hide it via CSS so that it is still visible on desktop view, I'm not sure:

eMNYtGk.png

Good to know how to disable the debug bar though - thx!

Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...