Commit d61a6b45 authored by Richard Mansfield's avatar Richard Mansfield
Browse files

Return sanitised copy of description from artefactchooser (bug #736665)



When we are going to display an html artefact description outside a
tinymce window, in 'read-only' mode, we need it to be cleaned up by
the server in advance.  This patch adds returns a safe version of an
artefact description along with the original description, when
requested in the artefactchooser configuration.

Change-Id: I8725e56608214bba0a262de78e6dac8fcf5a4dd8
Signed-off-by: default avatarRichard Mansfield <richard.mansfield@catalyst.net.nz>
parent 28390994
......@@ -100,7 +100,7 @@ class PluginBlocktypeTextbox extends PluginBlocktype {
'selectone' => true,
'selectjscallback' => 'updateTextContent',
'getblocks' => true,
'returnfields' => array('id', 'title', 'description', 'editable'),
'returnfields' => array('id', 'title', 'description', 'safedescription', 'editable'),
'artefacttypes' => array('html'),
'template' => 'artefact:internal:html-artefactchooser-element.tpl',
);
......
......@@ -2208,6 +2208,10 @@ class View {
if ($returnfields) {
$returnartefacts[$artefact->id] = array();
foreach ($returnfields as $f) {
if ($f == 'safedescription') {
$returnartefacts[$artefact->id]['safedescription'] = clean_html($artefact->description);
continue;
}
$returnartefacts[$artefact->id][$f] = $artefact->$f;
}
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment