*/
public function add_block($blockname, $region, $weight, $showinsubcontexts, $pagetypepattern = NULL, $subpagepattern = NULL) {
global $DB;
- $this->check_known_block_type($blockname);
+ // Allow invisible blocks because this is used when adding default page blocks, which
+ // might include invisible ones if the user makes some default blocks invisible
+ $this->check_known_block_type($blockname, true);
$this->check_region_is_known($region);
if (empty($pagetypepattern)) {
} else {
$pagetypepattern = 'course-view-*';
}
-
$page = new moodle_page();
$page->set_course($course);
$page->blocks->add_blocks($blocknames, $pagetypepattern);