$c->Is check if editing page settings
Permalink
Concrete 5 has $c->isEditMode() . is there an equivalent for Is Editing Page settings.
I am trying to disable a javascript file located in my footer, while I edit page settings. Currently when the javascript is loading, it is not bringing up the Save or Publish options of the composer section. The page section just stays loading. If i disable the js file, then it gives me all my options. IsEditMode() does not work for while in page settings as im not editing the page contents.
Thanks
I am trying to disable a javascript file located in my footer, while I edit page settings. Currently when the javascript is loading, it is not bringing up the Save or Publish options of the composer section. The page section just stays loading. If i disable the js file, then it gives me all my options. IsEditMode() does not work for while in page settings as im not editing the page contents.
Thanks
...
There is a global flag CCM_EDIT_MODE. A typical closure wrapping a ready handler would be:
You don't have to wrap it up like that, you can do the if(CCM_EDIT_MODE) any place you want.
If you look at any page source, there will be a block of useful constants near the top:
In recent v8 cores there is also a css class you can select on that is applied to the <html> element:
(function ($) { $(document).ready(function () { if(CCM_EDIT_MODE){ return; } }); })(jQuery);
You don't have to wrap it up like that, you can do the if(CCM_EDIT_MODE) any place you want.
If you look at any page source, there will be a block of useful constants near the top:
<script type="text/javascript"> var CCM_DISPATCHER_FILENAME = "/index.php"; var CCM_CID = 1; var CCM_EDIT_MODE = false; var CCM_ARRANGE_MODE = false; var CCM_IMAGE_PATH = "/concrete/images"; var CCM_TOOLS_PATH = "/index.php/tools/required"; var CCM_APPLICATION_URL = "https://c5magic.co.uk"; var CCM_REL = ""; var CCM_ACTIVE_LOCALE = "en_GB"; </script>
In recent v8 cores there is also a css class you can select on that is applied to the <html> element:
<html lang="en" class="ccm-toolbar-visible ccm-edit-mode ccm-panel-ready">
$c = Page::getCurrentPage();
if ( $c->isEditMode() ) {
} else {?>
<script src="<?php echo $this->getThemePath()?>/js/my.js"></script>
<?php } ?>
So if i click the gear icon in the Concrete 5 Toobar it wont load my action buttons or wont allow them to be clickable. So i need to disable the file while editing Page Settings.
if ( $c->isEditMode() ) {
} else {?>
<script src="<?php echo $this->getThemePath()?>/js/my.js"></script>
<?php } ?>
So if i click the gear icon in the Concrete 5 Toobar it wont load my action buttons or wont allow them to be clickable. So i need to disable the file while editing Page Settings.
Classes are applied to <html> for open panels, so you could select on those and if present, skip your script actions.
ccm-panel-open
ccm-panel-left
ccm-panel-open
ccm-panel-left