MDL-37186 add the ultimate TinyMCE custom parameter setting

This commit is contained in:
Petr Škoda 2012-12-18 17:49:27 +01:00
parent 0dc5a532ec
commit 23ac6ef6c5
4 changed files with 42 additions and 1 deletions

View file

@ -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">&#x2714;</span>';
} else {
$valid = '<span class="patherror">&#x2718;</span>';
}
$result = str_replace('</textarea>', '</textarea>'.$valid, $result);
}
return $result;
}
}