Custom content block including Concrete5's toolbar

Permalink 1 user found helpful
Hello,

I would like to know if there is a way to add the Concrete5 toolbar that allows you add images/links/files etc (see attached file) into my own custom block so that i can add images from the library into a content block. I've look around and can't find anything about it anywhere...

Thanks in advance,

Joshua :)

1 Attachment

 
hutman replied on at Permalink Reply
hutman
In your block you can add this to the top of the add/edit page that you are working with

<?php Loader::element('editor_config'); ?>


then when you create your wysiwyg textarea you do this

<?php Loader::element('editor_controls'); ?>
<textarea id="content" name="content" class="ccm-advanced-editor"><?php echo $content; ?></textarea>


That should give you the wysiwyg editor with the bar that you are looking for.
joshuabrand replied on at Permalink Reply
Thanks for this, it does show what i want but now the images don't show in either edit mode or normal mode... it just displays the name of the image in the content box, any ideas why?
hutman replied on at Permalink Reply
hutman
When you are adding the block and add an image does it show correctly the very first time?

I'm guessing that you need to use the tranlateFrom and translateTo functions. What version of concrete5 are you using? The best way to grab these is different depending on that.
joshuabrand replied on at Permalink Reply
No, it never shows correctly.. sometime it displays a broken image and others just the title?

and I'm running the most up to date version...
joshuabrand replied on at Permalink Reply
also, just looked at the source code and the reason it's not working is because it is putting /view_inline/ into the img src... if i remove that it works but surely i dont have to do that every time?
hutman replied on at Permalink Reply
hutman
I'm sorry I don't think my question was clear, when you are still editing and have just added an image (not after you save) does it show you the image in the wysiwyg box?

If so, you need to add this to the save function
Loader::helper('content')->translateTo($this->content);


and this to the view function
Loader::helper('content')->translateFrom($this->content);


So it translates your wysiwyg box to/from edit mode when you edit and save.
joshuabrand replied on at Permalink Reply
no, the image doesnt display anywhere.... it just varies from the title to a broken image thing.. even in the editor..

i added what you said and it still doesn't want to work!
hutman replied on at Permalink Reply
hutman
If you use just the regular Content block do the images show correctly in the editor?
joshuabrand replied on at Permalink Reply
i've just checked and no they dont :( they were working fine this morning though... how strange
hutman replied on at Permalink Reply
hutman
It almost seems like the BASE_URL in your /config/site.php might be wrong
joshuabrand replied on at Permalink Reply
i've just looked in my site.php and there is nothing that says BASE_URL... is there supposed to be?
hutman replied on at Permalink Reply
hutman
Try adding this to your /config/site.php with your URL

define('BASE_URL', 'http://www.yoururl.com');