"MDL-16639, added static function to read editor option names"

This commit is contained in:
Dongsheng Cai
2010-03-23 08:53:47 +00:00
parent 7a856a9330
commit 42f57b18b8
2 changed files with 13 additions and 3 deletions
+10 -3
View File
@@ -89,17 +89,24 @@ switch ($action) {
$pagename = 'editorsettings' . $editor;
admin_externalpage_setup($pagename);
$form = new $classname();
$options = $classname::option_names();
$data = $form->get_data();
// $form->addElement('hidden', 'action', 'edit');
if ($form->is_cancelled()){
// do nothing
} else if (!empty($data)) {
foreach ($data as $key=>$value) {
if (strpos($key, 'editor_') === 0) {
// editor options must be started with 'editor_'
if (strpos($key, 'editor_') === 0 && in_array($key, $options)) {
set_config($key, $value, 'editor');
}
}
} else {
$form->set_data(array('editor_tinymce_spellengine'=>get_config('editor', 'editor_tinymce_spellengine')));
$data = array();
foreach ($options as $key) {
$data[$key] = get_config('editor', $key);
}
$form->set_data($data);
$PAGE->set_pagetype('admin-editors-' . $editor);
admin_externalpage_print_header();
echo $OUTPUT->heading(get_string('modulename', 'editor_'.$editor));
+3
View File
@@ -19,4 +19,7 @@ class editor_settings_tinymce extends editor_settings_form {
parent::definition();
}
static public function option_names() {
return array('editor_tinymce_spellengine');
}
}