mirror of
https://github.com/moodle/moodle.git
synced 2025-08-09 19:06:41 +02:00
MDL-37186 add the ultimate TinyMCE custom parameter setting
This commit is contained in:
parent
0dc5a532ec
commit
23ac6ef6c5
4 changed files with 42 additions and 1 deletions
|
@ -246,3 +246,30 @@ class tiynce_subplugins_settings extends admin_setting {
|
|||
return highlight($query, $return);
|
||||
}
|
||||
}
|
||||
|
||||
class editor_tinymce_json_setting_textarea extends admin_setting_configtextarea {
|
||||
/**
|
||||
* Returns an XHTML string for the editor
|
||||
*
|
||||
* @param string $data
|
||||
* @param string $query
|
||||
* @return string XHTML string for the editor
|
||||
*/
|
||||
public function output_html($data, $query='') {
|
||||
$result = parent::output_html($data, $query);
|
||||
|
||||
$data = trim($data);
|
||||
if ($data) {
|
||||
$decoded = json_decode($data, true);
|
||||
// Note: it is not very nice to abuse these file classes, but anyway...
|
||||
if (is_array($decoded)) {
|
||||
$valid = '<span class="pathok">✔</span>';
|
||||
} else {
|
||||
$valid = '<span class="patherror">✘</span>';
|
||||
}
|
||||
$result = str_replace('</textarea>', '</textarea>'.$valid, $result);
|
||||
}
|
||||
|
||||
return $result;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue