MDL-24594 Fix some issues with the display of HTML choices.

The most significant issue is that the HTML editor alwasy wraps <p> tags round the input, but that is not appropriate for the choices. It is especially not appropriate because we want to display the choices in a <lable> for accessibility and usability reasons. In valid HTML label can only contain inline elemnts. Therefore, I introduced a make_html_inline method, with a minimal implementation. (It could be improved in future.)

Long term, I think the best option would be a new form field type, editorinline, or something like that. That would be a smaller version of TinyMCE that only lets you enter inline elements.
This commit is contained in:
Tim Hunt 2011-06-17 14:55:51 +01:00
parent 2a6c5c52ee
commit 35c9b65274
8 changed files with 47 additions and 15 deletions

View file

@ -298,9 +298,7 @@ abstract class question_definition {
* @return string the equivalent plain text.
*/
public function html_to_text($text, $format) {
$formatoptions = new stdClass();
$formatoptions->noclean = true;
return html_to_text(format_text($text, $format, $formatoptions), 0, false);
return html_to_text(format_text($text, $format, array('noclean' => true)), 0, false);
}
/** @return the result of applying {@link format_text()} to the question text. */