Using CKEDitor in my own modules.

edited April 2013 in Modules
Hi All,

How do I get to use the CKEditor in my own modules in 0.93? I have the following code when I am using formbuilder to create the form but I just get a simple textarea box.

$fields['make_content'] = array('type'=>'textarea','value'=> $make->make_content, 'class'=>'wysiwyg');

Comments

  • edited 4:30AM
    The wysiwyg class only works in the CMS and not on the front end because the javascript code to render the CKEditor box isn't loaded. You would need to add your own code for the front end to have a CKEditor field work.
  • edited 4:30AM
    Thanks for the quick response.... This is a module I have created in the CMS so do I have to do the CKEditor stuff myself?
  • edited 4:30AM
    I misread what you stated and interpreted it as a form being rendered on the front end. For the back end, The 1.0 beta uses a newer version of CKEditor and has improved integration with asset uploading and links. Adding the class "wysiwyg" should work. Are you seeing any other javascript errors on the page? Also, does it work if you set the text_editor option to "ckeditor" in the fuel/application/config/MY_fuel.php file?
  • edited 4:30AM
    HI,

    The config is set to ckeditor and is used in other parts of the CMS with no problems. It is only in my own advanced module that I just see a textbox. Is there something I need to do in the Javascript/form builder to get it to use ckeditor other than just defining a text area in the form builder and giving it a class of wysiwyg?

    BTW I am using 0.93 and I am getting no errors in the console but noticed that all the relevant JS scripts are loaded...
  • edited April 2013
    For that to be run in 0.93, the "add_edit" method on the BaseFuelController.js file needs to be run. This is the default method run if you are adding or editing a simple module. Have you created your own controller for your advanced module? If so, you'll need to set the following parameters in your controller:
    // set jqx javascript parameters $this->js_controller_params['method'] = 'add_edit';
  • edited 4:30AM
    HI,

    Yes I have my own controller for the advanced module I have created and have placed
    $this->js_controller_params['method'] = 'add_edit';
    In the controller methods that I want to use the ckeditor in. But I still do not see the ckeditor. Do I need to have my own Javascript controller too?

    Is their a good example I can look at or some documentation that covers this?
  • edited 4:30AM
    The validate advanced module may be helpful to look at. It has a fuel/modules/validate/assets/ValidateController.js file which is call from with the fuel/modules/validate/views/validate.php view file. The "validate" method in the javascript controller file is what is called on the main validate page. That is because the validate controller has this on line 44:
    $this->js_controller_params['method'] = 'validate';

    In your controller, I'd try calling the "_initEditors" which would be inherited from the BaseFuelController (note how ValidateController extends the BaseFuelController).
  • edited 4:30AM
    Excellent... Thanks for all the help and the Patience... Have created my own JS-Controller and have put in a -initEditors on a function which I call on a controller method... Works a treat.

    However, I tried to copy the Vaidate.js file which kept spitting out a JS error on the console. So I created the object in a different manner.

    var ManufacturerController = jqx.createController(fuel.controller.BaseFuelController,{
    });
  • edited 4:30AM
    That works too. Glad you got it figured out.
Sign In or Register to comment.