Detect if header is loaded

Permalink 2 users found helpful
Hey, is there a way to detect if the header bar is loaded? i know there is the is logged in check, and the is in edit mode check, but i don't see a way to detect if the bar is loaded.

any hints?

Mike

Mnkras
 
jgarcia replied on at Permalink Best Answer Reply
jgarcia
There's not a specific function for that. The edit bar is loaded in /concrete/elements/page_controls_header.php using the following check:
if ($cp->canWrite() || $cp->canAddSubContent() || $cp->canAdminPage() || $cp->canApproveCollection()) {
//Load header
}
Mnkras replied on at Permalink Reply
Mnkras
alright, I guess that works, would be nice if there was a build in function for it

*pokes core team*

Thanks
Fernandos replied on at Permalink Reply
Fernandos
Hi!

It would be cool if following would be possible Andrew.

<?php
$level = (int)User::getCollectionAdminLevel();
if(User::isLoggedIn() && $level === 3 ) {
/** Load when user AccessLevel Grants
*   access to the EditBar, where 3 is
*   just an imaginary example number.
*/
}


AutoIndent for this forum..just an idea I just had.. who knows maybe someone is doing that for the codeHighlighter block..
Proteus replied on at Permalink Reply
Proteus
I need some help on this. This if statement doesn't seem to do it for me.

I am trying to load a CSS file in a theme via an external link. Here is my code:

if (isset($cp)) {
   if ($cp->canWrite() || $cp->canAddSubContent() || $cp->canAdminPage() || $cp->canApproveCollection()) {
      print "<link rel=\"stylesheet\" href=\"".$this->getThemePath()."/editmode.css\" type=\"text/css\" media=\"all\"/>";
   }
}


I've been in contact with Mnkras about this because this is a theme I'm trying to submit to the market place. This code is being included in the theme's page via a PHP include (though it doesn't work either if I put it in directly).

I can see this is copied from the core itself, but I can't get anything within the if statement to execute, though print statements outside of it show up fine.
Mnkras replied on at Permalink Reply
Mnkras
try:
global $c;
$cp = new Permissions($c);
before it
Proteus replied on at Permalink Reply
Proteus
That did it, thank you!