public function initEditor() { ContentToolsAsset::register($this->getView()); $this->getView()->registerJs("var editor;" . "editor=ContentTools.EditorApp.get();" . "editor.init('*[" . static::dataAttribute($this->dataInit) . "]','" . static::dataAttribute($this->dataName) . "');" . $this->initSaveEngine(), View::POS_END); }
/** * Registers ContentToolsAsset. * Initiates ContentTools editor engine. */ public function initEditor() { ContentToolsAsset::register($this->getView()); $data_init = static::dataAttribute($this->dataInit); $data_name = static::dataAttribute($this->dataName); $js = <<<JS ;window.addEventListener('load', function () { var editor; editor = ContentTools.EditorApp.get(); editor.init('*[{$data_init}]', '{$data_name}'); {$this->initSaveEngine()} }); JS; $this->getView()->registerJs($js, View::POS_END); }