MDL-76583 core: Update uses of external_* classes

This commit is contained in:
Andrew Nicols
2023-01-19 07:34:09 +08:00
parent 3e1920966c
commit a3cc26f8bb
382 changed files with 4067 additions and 4443 deletions
+11 -7
View File
@@ -14,6 +14,8 @@
// You should have received a copy of the GNU General Public License
// along with Moodle. If not, see <http://www.gnu.org/licenses/>.
use core_external\util as external_util;
/**
* Form for editing HTML block instances.
*
@@ -21,9 +23,7 @@
* @copyright 1999 onwards Martin Dougiamas (http://dougiamas.com)
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
*/
class block_html extends block_base {
function init() {
$this->title = get_string('pluginname', 'block_html');
}
@@ -87,9 +87,6 @@ class block_html extends block_base {
}
public function get_content_for_external($output) {
global $CFG;
require_once($CFG->libdir . '/externallib.php');
$bc = new stdClass;
$bc->title = null;
$bc->content = '';
@@ -113,8 +110,15 @@ class block_html extends block_base {
if (isset($this->config->format)) {
$format = $this->config->format;
}
list($bc->content, $bc->contentformat) =
external_format_text($this->config->text, $format, $this->context, 'block_html', 'content', null, $filteropt);
[$bc->content, $bc->contentformat] = \core_external\util::format_text(
$this->config->text,
$format,
$this->context,
'block_html',
'content',
null,
$filteropt
);
$bc->files = external_util::get_area_files($this->context->id, 'block_html', 'content', false, false);
}