Hiding a block element in edit mode

Permalink Browser Info Environment
Thank you for creating this block. It allows a non-programmer from myself to create some great custom blocks for my client.

I have added a slider based on the jquery flexslider but it is not editable when I put the page in edit mode. I am able to add the various elements and the slider operates fine, but the if I add multiple slides, I am only able to edit the first slide. All other slides are hidden behind the first element. After some testing it appears that if I can hide the images from displaying in edit mode, my clients will be able to edit the slider.

Any tips on how to hide it in view.php file that is generated?

The code is:

<?php  defined('C5_EXECUTE') or die("Access Denied.");
?>
<li>
<div class="info animate-in">
<?php  if (!empty($field_2_textarea_text)): ?>
   <h3><?php  echo nl2br(htmlentities($field_2_textarea_text, ENT_QUOTES, APP_CHARSET)); ?></h3>
<?php  endif; ?>
<?php  if (!empty($field_3_textbox_text)): ?>
   <h2><?php  echo htmlentities($field_3_textbox_text, ENT_QUOTES, APP_CHARSET); ?></h2>
<?php  endif; ?>
<?php  if (!empty($field_4_textarea_text)): ?>
   <h4><?php  echo nl2br(htmlentities($field_4_textarea_text, ENT_QUOTES, APP_CHARSET)); ?></h4>
<?php  endif; ?>
<?php  if (!empty($field_5_textbox_text)): ?>
   <p><a href="<?php  echo htmlentities($field_5_textbox_text, ENT_QUOTES, APP_CHARSET); ?>" class="button button_pale">


Thanks again for creating such an amazing plugin.

Type: Discussion
Status: New
digievo
View Replies: View Best Answer
jordanlev replied on at Permalink Best Answer Reply
jordanlev
You can put the following code around anything in a block view to hide it while in edit mode:

<?php if (!Page::getCurrentPage()->isEditMode()): ?>
//...your stuff here
<?php endif; ?>

I think your best bet might be to put that around the javascript that initiates the slider. (Or you could put it around the images themselves if you want).

You also might be interested in this tutorial I wrote, which shows how to build a FlexSlider block (but it uses the file manager's File Sets to choose the images, not Designer Content):
http://c5blog.jordanlev.com/blog/2011/12/build-a-slideshow-block/...

Best,
Jordan
digievo replied on at Permalink Reply
digievo
Thank you so much Jordan. That worked really well.

I will also look at your tutorial.

concrete5 Environment Information

Browser User-Agent String

Hide Post Content

This will replace the post content with the message: "Content has been removed by an Administrator"

Hide Content

Request Refund

You have not specified a license for this support ticket. You must have a valid license assigned to a support ticket to request a refund.