make hidden content visible during editing

Permalink
I have an image with a hovering caption. When the caption class is applied on the content block, the caption is hidden. This makes it difficult to edit.

Question: How can i have the caption visible during editing?
Can it be done with css or does it need to done in php?

helvetica
View Replies:
rge replied on at Permalink Reply
Both are possible. You need to get the page object on this you can use isEditMode();
$c = \Concrete\Core\Page\Page::getCurrentPage();
$c->isEditMode();


Option 1 - css class
See the answer of JohntheFish
.ccm-edit-mode .my-class { display: block; }


Option 2 - element visibility
<?php if(!$c->isEditMode()):?>
   <div class="caption"></div>
<?php endif; ?>
JohntheFish replied on at Permalink Reply
JohntheFish
On recent cores you can do this entirely in css. When a page is in edit mode, the core adds the class 'ccm-edit-mode' to the <html> element:
<html lang="en" class="ccm-toolbar-visible ccm-edit-mode ccm-panel-ready">


Along the lines of:
.whatever-class { 
  display:none;
}
.ccm-edit-mode .whatever-class { 
  display:block;
}
helvetica replied on at Permalink Reply
helvetica
Thank you rge and johnthefish.
For some reason i couldn't make it work yet.
This is probably because of the rather complicated setup within an isotope grid.
I'll keep on working on it.