From 82d491cafadf7f1e99d880122454e0678d5fff57 Mon Sep 17 00:00:00 2001 From: Meirza Date: Wed, 9 Nov 2022 09:30:31 +0700 Subject: [PATCH] MDL-76229 core_form: Show frozen text editor in a more accessible way. --- lib/form/editor.php | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/lib/form/editor.php b/lib/form/editor.php index 6d7c700cb8f..c985854458a 100644 --- a/lib/form/editor.php +++ b/lib/form/editor.php @@ -248,6 +248,15 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element implements templatab $this->_options['subdirs'] = (int)($allow == 1); } + /** + * Returns editor text content + * + * @return string Text content + */ + public function get_text(): string { + return $this->_values['text']; + } + /** * Returns editor format * @@ -491,13 +500,12 @@ class MoodleQuickForm_editor extends HTML_QuickForm_element implements templatab } /** - * What to display when element is frozen. + * Returns the formatted value. The return from parent class is not acceptable. * - * @return empty string + * @return string */ - function getFrozenHtml() { - - return ''; + public function getFrozenHtml(): string { + return format_text($this->get_text(), $this->getFormat()) . $this->_getPersistantData(); } /** -- 2.43.0