forked from sheadawson/silverstripe-shortcodable
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_config.php
27 lines (23 loc) · 1.07 KB
/
_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
27
<?php
use SilverStripe\Core\Config\Config;
use SilverStripe\Forms\HTMLEditor\HtmlEditorConfig;
use Silverstripe\Shortcodable;
if (!defined('SHORTCODABLE_DIR')) {
define('SHORTCODABLE_DIR', rtrim(basename(dirname(__FILE__))));
}
if (SHORTCODABLE_DIR != 'silverstripe-shortcodable') {
throw new \Exception('The edit shortcodable module is not installed in correct directory. The directory should be named "shortcodable"');
}
// enable shortcodable buttons and add to HtmlEditorConfig
$htmlEditorNames = Config::inst()->get('Shortcodable', 'htmleditor_names');
if (is_array($htmlEditorNames)) {
foreach ($htmlEditorNames as $htmlEditorName) {
// HtmlEditorConfig::get($htmlEditorName)->enablePlugins(array(
// 'shortcodable' => sprintf('/resources/%s/javascript/editor_plugin.js', SHORTCODABLE_DIR)
// ));
HtmlEditorConfig::get($htmlEditorName)->addButtonsToLine(1, 'shortcodable');
}
}
// register classes added via yml config
$classes = Config::inst()->get('Shortcodable', 'shortcodable_classes');
Shortcodable::register_classes($classes);