mirror of
https://github.com/moodle/moodle.git
synced 2025-08-05 17:06:53 +02:00
Just a little bit more reobust in the face of badly-behaved blocks
This commit is contained in:
parent
221a85301e
commit
7933cc6be5
1 changed files with 7 additions and 3 deletions
|
@ -154,11 +154,15 @@ function blocks_delete_instance($instance) {
|
||||||
// by reference for speed; the array is actually not modified.
|
// by reference for speed; the array is actually not modified.
|
||||||
function blocks_have_content(&$instances) {
|
function blocks_have_content(&$instances) {
|
||||||
foreach($instances as $instance) {
|
foreach($instances as $instance) {
|
||||||
if(!$instance->visible) {
|
if (!$instance->visible) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!$record = blocks_get_record($instance->blockid)) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (!$obj = block_instance($record->name, $instance)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
$record = blocks_get_record($instance->blockid);
|
|
||||||
$obj = block_instance($record->name, $instance);
|
|
||||||
$content = $obj->get_content();
|
$content = $obj->get_content();
|
||||||
$type = $obj->get_content_type();
|
$type = $obj->get_content_type();
|
||||||
switch($type) {
|
switch($type) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue