Empty Content Block problem

Permalink
I have content blocks that have nothing in them. I can add text to the block and edit that text but if I remove the text entirely I get 'Empty Content Block' in the block that only disappears if I place a character there. How can I return to the original block state, no content in the block without the 'Empty Content Block' message?

 
tjbphoto replied on at Permalink Reply
tjbphoto
Hi there
I presume you have tried deleting the block ?
alan1948 replied on at Permalink Reply
Thanks for the response.

I know that the block could be deleted and then added back but that is not
what an end user expects to have to do.

The user of the website wants to retain the background colour of the block
and either amend or delete the text as and when they choose but this does
not seem possible.

Regards
Alan Dix


On 17 April 2018 at 05:02, concrete5 Community <discussions@concretecms.com>
wrote:
jasteele12 replied on at Permalink Reply
jasteele12
You could easily create a Content block view Template that does what they want. The following is untested but should work. In this example "keep_empty" would be called "Keep Empty" in the frontend. You could call it whatever you want.

Copy concrete/blocks/content/view.php to a newly created application/blocks/content/templates/keep_emtpy/view.php

Edit the copy, to look like this (if you compare it to the original it's just removed a few lines that display 'Empty Content Block':
<?php /* application/blocks/content/templates/keep_empty/view */
defined('C5_EXECUTE') or die("Access Denied.");
$c = Page::getCurrentPage();
if (!$content && is_object($c) && $c->isEditMode()) {
    echo ' ';
} else {
    echo $content;
}
alan1948 replied on at Permalink Reply
Thank you, I will try that in the next day or so.

Regards
Alan Dix


On 17 April 2018 at 23:17, concrete5 Community <discussions@concretecms.com>
wrote: