Using canViewToolbar() in 5.7 theme - How?

Permalink 1 user found helpful
Hi I am trying to make my first theme in 5.7 and I have a problem to understand how to change the call to the canViewToolbar() function.

I have tried a lot of things resulting in a lot of errors (too many to list here).

In 5.6 the code was as follows:
global $cp;
$canViewToolbar = (isset($cp) && is_object($cp) && $cp->canViewToolbar());
if ($canViewToolbar) {
    //do something...
}


How do I implement this in 5.7

Thanks in advance!

/Michael

maar
 
hissy replied on at Permalink Best Answer Reply
hissy
$c = Page::getCurrentPage();
if (is_object($c)) {
   $cp = new Permissions($c);
   if ($cp->canViewToolbar()) {
      //do something...
   }
}
maar replied on at Permalink Reply
maar
Thanks... Works perfectly... Cool...

/Michael
hissy replied on at Permalink Reply
hissy
Good luck! ;-)

This website stores cookies on your computer. These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media. To find out more about the cookies we use, see our Privacy Policy.