2 // This file is part of Moodle - http://moodle.org/
4 // Moodle is free software: you can redistribute it and/or modify
5 // it under the terms of the GNU General Public License as published by
6 // the Free Software Foundation, either version 3 of the License, or
7 // (at your option) any later version.
9 // Moodle is distributed in the hope that it will be useful,
10 // but WITHOUT ANY WARRANTY; without even the implied warranty of
11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 // GNU General Public License for more details.
14 // You should have received a copy of the GNU General Public License
15 // along with Moodle. If not, see <http://www.gnu.org/licenses/>.
18 * Tiny subplugin management.
20 * @package editor_tinymce
21 * @copyright 2023 Andrew Lyons <andrew@nicols.co.uk>
22 * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
25 require(__DIR__
. '/../../../config.php');
26 require_once("{$CFG->libdir}/adminlib.php");
28 $action = optional_param('action', '', PARAM_ALPHA
);
29 $plugin = optional_param('plugin', '', PARAM_PLUGIN
);
31 $PAGE->set_context(context_system
::instance());
32 $PAGE->set_url('/lib/editor/tinymce/subplugins.php');
35 require_capability('moodle/site:config', context_system
::instance());
38 $tinymanager = \core_plugin_manager
::resolve_plugininfo_class('tiny');
39 $pluginname = get_string('pluginname', "tiny_{$plugin}");
43 if ($tinymanager::enable_plugin($plugin, 0)) {
44 \core\notification
::add(
45 get_string('plugin_disabled', 'editor_tiny', $pluginname),
46 \core\notification
::SUCCESS
51 if ($tinymanager::enable_plugin($plugin, 1)) {
52 \core\notification
::add(
53 get_string('plugin_enabled', 'editor_tiny', $pluginname),
54 \core\notification
::SUCCESS
61 redirect(new moodle_url('/admin/settings.php', [
62 'section' => 'editorsettingstiny',