<?php
namespace cms;

/* Add this to text field to enable WYSIWYG editing / html */
class Controller_Elrte extends \AbstractController {
	function init(){
		parent::init();
		$f=$this->owner->form;		// form

        $f->template->appendHTML('Content',
                '<link type="text/css" href="'.$this->api->locateURL('css','elrte/css/elrte.full.css').'" rel="stylesheet" />'."\n");
        $f->setFormClass("empty");
        /*
        $f->getElement("images")->allowMultiple(10)
            ->setFormatFilesTemplate("view/cms_files");
            */

        $this->owner->js(true)->_selectorRegion()->show();
        $this->owner
            ->setCaption('')
            ->js(true)->_load('elrte/js/elrte.min')
            ->addClass("elrte_editor")
            ->elrte(array('width'=>900,
                'height'=>300,
                //'cssfiles'=>array($this->api->locateURL('css','elrte/css/editor.css')),
                'toolbar'=> 'maxi')
            );
        $this->submit_btn=$f->addSubmit('Save');
        $this->submit_btn->js(true)->unbind("click")->bind("click", $this->submit_btn->js(null, '$(".elrte_editor").elrte()[0].save();return false')->_enclose());
    }
}
Add controller which enables elrte on text field
Add controller which enables elrte on text field
