diff --git a/public/lib/blocklib.php b/public/lib/blocklib.php index c19c7086e6e..b803163b317 100644 --- a/public/lib/blocklib.php +++ b/public/lib/blocklib.php @@ -1469,7 +1469,7 @@ class block_manager { if ($parentcontext->id != $systemcontext->id && is_inside_frontpage($parentcontext)) { $messagestring->pagetype = get_string('showonfrontpageandsubs', 'block'); } else { - $pagetypes = generate_page_type_patterns($this->page->pagetype, $parentcontext); + $pagetypes = generate_page_type_patterns($this->page->pagetype, $parentcontext, $this->page->context); $messagestring->pagetype = $block->instance->pagetypepattern; if (isset($pagetypes[$block->instance->pagetypepattern])) { $messagestring->pagetype = $pagetypes[$block->instance->pagetypepattern]; @@ -1686,7 +1686,7 @@ class block_manager { if ($parentcontext->id != $systemcontext->id && is_inside_frontpage($parentcontext)) { $messagestring->pagetype = get_string('showonfrontpageandsubs', 'block'); } else { - $pagetypes = generate_page_type_patterns($this->page->pagetype, $parentcontext); + $pagetypes = generate_page_type_patterns($this->page->pagetype, $parentcontext, $this->page->context); $messagestring->pagetype = $block->instance->pagetypepattern; if (isset($pagetypes[$block->instance->pagetypepattern])) { $messagestring->pagetype = $pagetypes[$block->instance->pagetypepattern]; diff --git a/public/lib/questionlib.php b/public/lib/questionlib.php index 09d721cbb65..dbbb23d31ea 100644 --- a/public/lib/questionlib.php +++ b/public/lib/questionlib.php @@ -1825,7 +1825,7 @@ function question_page_type_list($pagetype, $parentcontext, $currentcontext): ar 'question-export' => get_string('page-question-export', 'question'), 'question-import' => get_string('page-question-import', 'question') ]; - if ($currentcontext->contextlevel == CONTEXT_COURSE) { + if ($currentcontext && $currentcontext->contextlevel == CONTEXT_COURSE) { require_once($CFG->dirroot . '/course/lib.php'); return array_merge(course_page_type_list($pagetype, $parentcontext, $currentcontext), $types); } else {