diff --git a/lib/editor/tiny/classes/manager.php b/lib/editor/tiny/classes/manager.php index 61a483b133a..4174f06a449 100644 --- a/lib/editor/tiny/classes/manager.php +++ b/lib/editor/tiny/classes/manager.php @@ -61,6 +61,8 @@ class manager { continue; } + $options['pluginname'] = $pluginname; + if (!$classname::is_enabled($context, $options, $fpoptions, $editor)) { // This plugin has disabled itself for some reason. // This is typical for media plugins where there is no file storage. diff --git a/lib/editor/tiny/classes/plugin.php b/lib/editor/tiny/classes/plugin.php index 678907eedb1..861e3784e01 100644 --- a/lib/editor/tiny/classes/plugin.php +++ b/lib/editor/tiny/classes/plugin.php @@ -34,7 +34,7 @@ use context; */ abstract class plugin { /** - * Whether the plugin is enabled + * Whether the plugin is enabled and accessible (e.g. capability checks). * * @param context $context The context that the editor is used within * @param array $options The options passed in when requesting the editor @@ -48,7 +48,18 @@ abstract class plugin { array $fpoptions, ?editor $editor = null ): bool { - return true; + $plugin = $options['pluginname']; + $capability = "tiny/$plugin:use"; + if (!get_capability_info($capability)) { + // Debug warning that the capability does not exist. + debugging( + 'The tiny ' . $plugin . ' plugin does not define the standard capability ' . $capability , + DEBUG_DEVELOPER + ); + return true; + } + + return has_capability($capability, $context); } /**