Despite the lack of documentation, displaying the advanced editor in concrete5 is very easy – and rightfully so. Basically we just need to use the Loader class to load what is needed to use TinyMCE and then give our textarea a class. That’s it!
In this example, we will use the form helper to render our textarea, but this is not a requirement; simply writing the textarea HTML by hand will get the job done as well.
Open the file in which you want to render the advanced editor and add the below.
$form = Loader::helper('form'); // If you want to use the form helper Loader::element('editor_config');
This is all that is required to render our TinyMCE advanced editor. Add the following (or the corresponding HTML code) to make a compatible textarea.
echo $form->textarea('txtContent', array( 'class' => 'ccm-advanced-editor' ));
As you can see, we have added the class ccm-advanced-editor. This is the class that TinyMCE is looking for so that it is optional per textarea.
To allow users to add images and more to the TinyMCE editor, editor controls can be displayed. These controls can easily be presented in a pane above the editor or wherever you may want. Simply add the line below where you want to render the controls.
3 comments on »Displaying the TinyMCE Editor in concrete5«
Okay, for my public-facing External Form, I added
to the External Form controller’s on_start method to enable TinyMCEifying the textarea.
Thank you very much for your comment. Sorry that I was not able to assist you in time, but I am happy to see that you found a solution to your problem.