-
Notifications
You must be signed in to change notification settings - Fork 0
/
boot.php
34 lines (24 loc) · 1.13 KB
/
boot.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
<?php
declare(strict_types=1);
namespace FriendsOfRedaxo\AceEditor;
use rex;
use rex_addon;
use rex_plugin;
use rex_view;
$addon = rex_addon::get('aceeditor');
$config = $addon->getConfig();
if (true === rex::isBackend() && null !== rex::getUser() && '|1|' === $addon->getConfig('active')) {
if (true === rex_plugin::get('be_style', 'customizer')->isInstalled() && 1 === rex_plugin::get('be_style', 'customizer')->getConfig('codemirror')) {
return;
}
// Set default selectors if not present
if ('' === $config['selectors']) {
$config['selectors'] = 'textarea.rex-code, textarea.rex-js-code, textarea.aceeditor, textarea.codemirror';
}
rex_view::setJsProperty('aceeditor_selectors', $config['selectors']);
rex_view::setJsProperty('aceeditor_defaulttheme', $config['theme']);
rex_view::setJsProperty('aceeditor_defaultdarktheme', $config['darktheme']);
rex_view::setJsProperty('aceeditor_options', $config['options']);
rex_view::addCssFile($addon->getAssetsUrl('css/aceeditor.min.css'));
rex_view::addJsFile($addon->getAssetsUrl('js/aceeditor.min.js'), [rex_view::JS_IMMUTABLE => true]);
}