blocks MDL-24040 Creating course fails horribly if you make one of the default blocks invisible

This commit is contained in:
Sam Marshall
2010-09-01 17:36:46 +00:00
parent 46e1237279
commit 51f96f5bd9
+3 -2
View 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);