Skip to content
Snippets Groups Projects
Commit 2adf38c8 authored by Kathrin Osswald's avatar Kathrin Osswald
Browse files

Added check to prevent errors on sites with course context but withaout a courseadmin node.

parent 777eae3a
No related branches found
No related tags found
No related merge requests found
......@@ -254,6 +254,8 @@ function theme_boost_campus_get_incourse_settings() {
if ($PAGE->context->contextlevel == CONTEXT_COURSE || $PAGE->context->contextlevel == CONTEXT_MODULE) {
// Get the courseadmin node for the current page.
$node = $PAGE->settingsnav->find('courseadmin', navigation_node::TYPE_COURSE);
// Check if $node is not empty for other pages like for example the langauge customization page.
if (!empty($node)) {
// If the setting 'incoursesettingsswitchtorole' is enabled add these to the $node.
if (get_config('theme_boost_campus', 'incoursesettingsswitchtorole') == 'yes' && !is_role_switched($COURSE->id)) {
// Build switch role link
......@@ -284,5 +286,6 @@ function theme_boost_campus_get_incourse_settings() {
}
}
}
}
return $node;
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment