blocks MDL-24040 Creating course fails horribly if you make one of the default blocks...
authorSam Marshall <s.marshall@open.ac.uk>
Wed, 1 Sep 2010 17:36:46 +0000 (17:36 +0000)
committerSam Marshall <s.marshall@open.ac.uk>
Wed, 1 Sep 2010 17:36:46 +0000 (17:36 +0000)
lib/blocklib.php

index f6e90f4..a2003b5 100644 (file)
@@ -578,7 +578,9 @@ class block_manager {
      */
     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)) {
@@ -1824,7 +1826,6 @@ function blocks_add_default_course_blocks($course) {
     } else {
         $pagetypepattern = 'course-view-*';
     }
-
     $page = new moodle_page();
     $page->set_course($course);
     $page->blocks->add_blocks($blocknames, $pagetypepattern);