Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'MDL-36881-m23' of git://github.com/andrewnicols/moodle …

…into MOODLE_23_STABLE
  • Loading branch information...
commit 3134895c01483fa805b39ecdb6233305cded4dd6 2 parents 8108e11 + b19ecdb
@samhemelryk samhemelryk authored
Showing with 7 additions and 2 deletions.
  1. +7 −2 course/lib.php
View
9 course/lib.php
@@ -1952,7 +1952,8 @@ function get_module_metadata($course, $modnames, $sectionreturn = null) {
// NOTE: this is legacy stuff, module subtypes are very strongly discouraged!!
$gettypesfunc = $modname.'_get_types';
if (function_exists($gettypesfunc)) {
- if ($types = $gettypesfunc()) {
+ $types = $gettypesfunc();
+ if (is_array($types) && count($types) > 0) {
$group = new stdClass();
$group->name = $modname;
$group->icon = $OUTPUT->pix_icon('icon', '', $modname, array('class' => 'icon'));
@@ -2001,7 +2002,11 @@ function get_module_metadata($course, $modnames, $sectionreturn = null) {
$module->archetype = plugin_supports('mod', $modname, FEATURE_MOD_ARCHETYPE, MOD_ARCHETYPE_OTHER);
$modlist[$course->id][$modname] = $module;
}
- $return[$modname] = $modlist[$course->id][$modname];
+ if (isset($modlist[$course->id][$modname])) {
+ $return[$modname] = $modlist[$course->id][$modname];
+ } else {
+ debugging("Invalid module metadata configuration for {$modname}");
+ }
}
return $return;
Please sign in to comment.
Something went wrong with that request. Please try again.