language = $this->getConfig('language', 'php'); $this->showGutter = $this->getConfig('showGutter', true); $this->theme = $this->getConfig('theme', $editorSettings->theme); $this->wrapWords = $this->getConfig('wrapWords', $editorSettings->use_wrap); $this->fontSize = $this->getConfig('fontSize', $editorSettings->font_size); $this->tabSize = $this->getConfig('tabSize', $editorSettings->tab_size); $this->useSoftTabs = $this->getConfig('useSoftTabs', !$editorSettings->use_hard_tabs); $this->margin = $this->getConfig('margin', 0); } /** * {@inheritDoc} */ public function render() { $this->prepareVars(); return $this->makePartial('codeeditor'); } /** * Prepares the list data */ public function prepareVars() { $this->vars['stretch'] = $this->formField->stretch; $this->vars['size'] = $this->formField->size; $this->vars['language'] = $this->language; $this->vars['showGutter'] = $this->showGutter; $this->vars['wrapWords'] = $this->wrapWords; $this->vars['fontSize'] = $this->fontSize; $this->vars['tabSize'] = $this->tabSize; $this->vars['useSoftTabs'] = $this->useSoftTabs; $this->vars['theme'] = $this->theme; $this->vars['name'] = $this->formField->getName(); $this->vars['value'] = $this->model->{$this->columnName}; $this->vars['margin'] = $this->margin; } /** * {@inheritDoc} */ public function loadAssets() { $this->addCss('css/codeeditor.css', 'core'); $this->addJs('vendor/ace/ace.js', 'core'); $this->addJs('js/codeeditor.js', 'core'); } }