forked from TheSceneman/silverstripe-glossary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
_config.php
21 lines (17 loc) · 948 Bytes
/
_config.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
<?php
use TheSceneman\SilverStripeGlossary\View\GlossaryShortcodeProvider;
use SilverStripe\View\Parsers\ShortcodeParser;
use SilverStripe\Core\Manifest\ModuleResourceLoader;
use SilverStripe\Forms\HTMLEditor\HTMLEditorConfig;
use SilverStripe\Core\Environment;
// Register our glossary shortcode handler
ShortcodeParser::get('default')
->register('glossary_term', [GlossaryShortcodeProvider::class, 'handle_shortcode']);
// We should remove the "Glossary" button from the WYSIWYG field for Glossary Term Definition
$restrictedConfig = clone HTMLEditorConfig::get('cms');
HTMLEditorConfig::set_config('glossary', $restrictedConfig);
// Add glossary button to WYSIWYG
$editorConfig = HTMLEditorConfig::get(Environment::getEnv('HTML_EDITOR') ?? 'cms');
$editorConfig->enablePlugins([
'glossary' => ModuleResourceLoader::resourceURL('vendor/heyday/silverstripe-glossary/client/dist/js/glossary.js'),
])->addButtonsToLine(3, 'ssglossary');