determine if in edit mode in block template
Permalink 1 user found helpful
i am making a custom block template in which i would like to execute a certain bit of code only if the page is in edit mode. is there a way to say "if in edit mode do this..."?
for anyone else who may be wondering...
it gets screwy when moving it around in edit->position mode, so it is best to just render the blockID, the block name and saying something like this is a google calendar that you are moving.
This is also great for sneaking in an extra style sheet whether or not C5 is in edit mode (to, for instance, fix positioning if you have blocks that are covering area buttons).
i.e.:
thanks jgarcia…
i.e.:
thanks jgarcia…
IMHO A better solution to have different csses is to check whether you're logged in, otherwise you have to edit the page to see the difference:
Shortform:
<!-- Is the page in EDIT MODE? --> <?php global $c; if ($c->isEditMode()) {print "<link href=\"".$this->getThemePath()."/mainedit.css\" rel=\"stylesheet\" type=\"text/css\" media=\"all\"/>";} ?> <!-- is the user LOGGED IN?--> <?php global $u; if ($u->isLoggedIn()) {print "<link href=\"".$this->getThemePath()."/mainedit.css\" rel=\"stylesheet\" type=\"text/css\" media=\"all\"/>";} ?>
Shortform: