forked from sheadawson/silverstripe-shortcodable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy path_config.php
26 lines (22 loc) · 1015 Bytes
/
_config.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
<?php
use SilverStripe\Core\Config\Config;
use SilverStripe\Core\Manifest\ModuleResourceLoader;
use SilverStripe\Forms\HTMLEditor\HtmlEditorConfig;
use Silverstripe\Shortcodable\Shortcodable;
if (!defined('SHORTCODABLE_DIR')) {
define('SHORTCODABLE_DIR', rtrim(basename(dirname(__FILE__))));
}
// enable shortcodable buttons and add to HtmlEditorConfig
$htmlEditorNames = Config::inst()->get(Shortcodable::class, 'htmleditor_names');
$jsFile = ModuleResourceLoader::singleton()->resolveURL('silverstripe/shortcodable:javascript/editor_plugin.js');
if (is_array($htmlEditorNames)) {
foreach ($htmlEditorNames as $htmlEditorName) {
HtmlEditorConfig::get($htmlEditorName)->enablePlugins(array(
'shortcodable' => $jsFile,
));
HtmlEditorConfig::get($htmlEditorName)->addButtonsToLine(1, 'shortcodable');
}
}
// register classes added via yml config
$classes = Config::inst()->get(Shortcodable::class, 'shortcodable_classes');
Shortcodable::register_classes($classes);