MDL-50491 admin: new setting class for list of filters.

This commit is contained in:
Tim Hunt 2015-06-05 16:38:57 +01:00
parent 502561d657
commit a94b2cb873
2 changed files with 48 additions and 0 deletions

View file

@ -3,6 +3,10 @@ information provided here is intended especially for developers.
=== 3.0 === === 3.0 ===
* New admin setting class admin_setting_filter_types which can be used if you
want to make the disablefilters value in your code configurable.
* Methods filter_manager::text_filtering_hash and moodle_text_filter::hash have been * Methods filter_manager::text_filtering_hash and moodle_text_filter::hash have been
deprecated. There were use by the old Moodle filtered text caching system deprecated. There were use by the old Moodle filtered text caching system
that was removed several releases ago. that was removed several releases ago.

View file

@ -4724,6 +4724,50 @@ class admin_setting_pickroles extends admin_setting_configmulticheckbox {
} }
/**
* Admin setting that is a list of installed filter plugins.
*
* @copyright 2015 The Open University
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class admin_setting_pickfilters extends admin_setting_configmulticheckbox {
/**
* Constructor
*
* @param string $name unique ascii name, either 'mysetting' for settings
* that in config, or 'myplugin/mysetting' for ones in config_plugins.
* @param string $visiblename localised name
* @param string $description localised long description
* @param array $default the default. E.g. array('urltolink' => 1, 'emoticons' => 1)
*/
public function __construct($name, $visiblename, $description, $default) {
if (empty($default)) {
$default = array();
}
$this->load_choices();
foreach ($default as $plugin) {
if (!isset($this->choices[$plugin])) {
unset($default[$plugin]);
}
}
parent::__construct($name, $visiblename, $description, $default, null);
}
public function load_choices() {
if (is_array($this->choices)) {
return true;
}
$this->choices = array();
foreach (core_component::get_plugin_list('filter') as $plugin => $unused) {
$this->choices[$plugin] = filter_get_name($plugin);
}
return true;
}
}
/** /**
* Text field with an advanced checkbox, that controls a additional $name.'_adv' setting. * Text field with an advanced checkbox, that controls a additional $name.'_adv' setting.
* *