Merge branch 'MDL-70141-master' of https://github.com/sammarshallou/moodle
authorSara Arjona <sara@moodle.com>
Wed, 11 Nov 2020 07:39:14 +0000 (08:39 +0100)
committerSara Arjona <sara@moodle.com>
Wed, 11 Nov 2020 07:39:14 +0000 (08:39 +0100)
blocks/classes/external.php

index cc08180..41cddfa 100644 (file)
@@ -92,6 +92,9 @@ class core_block_external extends external_api {
     private static function get_all_current_page_blocks($includeinvisible = false, $returncontents = false) {
         global $PAGE, $OUTPUT;
 
+        // Set page URL to a fake URL to avoid errors.
+        $PAGE->set_url(new \moodle_url('/webservice/core_block_external/'));
+
         // Load the block instances for all the regions.
         $PAGE->blocks->load_blocks($includeinvisible);
         $PAGE->blocks->create_all_block_instances();