MDL-72720 filter: Implement enable_plugin() method

This commit is contained in:
Sara Arjona 2021-10-04 16:04:36 +02:00
parent 0543ea7f02
commit e76c7375e2
2 changed files with 35 additions and 7 deletions

View file

@ -72,10 +72,8 @@ switch ($action) {
case 'setstate':
if (isset($filters[$filterpath]) and $newstate = optional_param('newstate', '', PARAM_INT)) {
filter_set_global_state($filterpath, $newstate);
if ($newstate == TEXTFILTER_DISABLED) {
filter_set_applies_to_strings($filterpath, false);
}
$class = \core_plugin_manager::resolve_plugininfo_class('filter');
$class::enable_plugin($filterpath, $newstate);
}
break;
@ -83,12 +81,16 @@ switch ($action) {
if (isset($filters[$filterpath])) {
$applytostrings = optional_param('stringstoo', false, PARAM_BOOL);
filter_set_applies_to_strings($filterpath, $applytostrings);
reset_text_filters_cache();
core_plugin_manager::reset_caches();
}
break;
case 'down':
if (isset($filters[$filterpath])) {
filter_set_global_state($filterpath, $filters[$filterpath]->active, 1);
reset_text_filters_cache();
core_plugin_manager::reset_caches();
}
break;
@ -96,14 +98,14 @@ switch ($action) {
if (isset($filters[$filterpath])) {
$oldpos = $filters[$filterpath]->sortorder;
filter_set_global_state($filterpath, $filters[$filterpath]->active, -1);
reset_text_filters_cache();
core_plugin_manager::reset_caches();
}
break;
}
// Reset caches and return.
// Return.
if ($action) {
reset_text_filters_cache();
core_plugin_manager::reset_caches();
redirect(new moodle_url('/admin/filters.php'));
}