Skip to content

Commit 83c4f53

Browse files
Fixed compatibility with mod_hvp.
1 parent 8c1f22b commit 83c4f53

2 files changed

Lines changed: 24 additions & 18 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file.
1919
- New {mygroupings} tag.
2020
### Updated
2121
- Link to External LTI now only available in Moodle 4.3+.
22+
- Addressed compatibility issue with mod_hvp that prevents link to current theme settings from working.
2223
- Refactoring in preparations for Moodle 4.5.
2324
- Added more documentation to README.md.
2425
- Fixed links and updated table of contents in README.md.

classes/text_filter.php

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -887,16 +887,18 @@ private function generatortags(&$text) {
887887
$menu .= '-{getstring}site{/getstring}: {getstring:admin}' . $label . '{/getstring}|/admin/settings.php' .
888888
'?section=' . $section . '|Including custom menus, designer mode, theme in URL' . PHP_EOL;
889889

890-
if (file_exists($CFG->dirroot . '/theme/' . $theme . '/settings.php')) {
891-
require_once($CFG->libdir . '/adminlib.php');
892-
if (admin_get_root()->locate('theme_' . $theme)) {
893-
// Settings use categories interface URL.
894-
$url = '/admin/category.php?category=theme_' . $theme . PHP_EOL;
895-
} else {
896-
// Settings use tabs interface URL.
897-
$url = '/admin/settings.php?section=themesetting' . $theme . PHP_EOL;
890+
if (!file_exists($CFG->dirroot . '/mod/hvp/version.php')) { // Not compatible with mod_hvp.
891+
if (file_exists($CFG->dirroot . '/theme/' . $theme . '/settings.php')) {
892+
require_once($CFG->libdir . '/adminlib.php');
893+
if (admin_get_root()->locate('theme_' . $theme)) {
894+
// Settings use categories interface URL.
895+
$url = '/admin/category.php?category=theme_' . $theme . PHP_EOL;
896+
} else {
897+
// Settings use tabs interface URL.
898+
$url = '/admin/settings.php?section=themesetting' . $theme . PHP_EOL;
899+
}
900+
$menu .= '-{getstring}site{/getstring}: {getstring:admin}currenttheme{/getstring}|' . $url;
898901
}
899-
$menu .= '-{getstring}site{/getstring}: {getstring:admin}currenttheme{/getstring}|' . $url;
900902
}
901903
$menu .= '-{getstring}site{/getstring}: {getstring}notifications{/getstring} ({getstring}admin{/getstring})' .
902904
'|/admin/index.php' . PHP_EOL;
@@ -1045,16 +1047,19 @@ private function generatortags(&$text) {
10451047
$menu .= '-###' . PHP_EOL;
10461048
$menu .= '-{getstring:admin}' . $label . '{/getstring}|/admin/settings.php' .
10471049
'?section=' . $section . '|Including custom menus, designer mode, theme in URL' . PHP_EOL;
1048-
if (file_exists($CFG->dirroot . '/theme/' . $theme . '/settings.php')) {
1049-
require_once($CFG->libdir . '/adminlib.php');
1050-
if (admin_get_root()->locate('theme_' . $theme)) {
1051-
// Settings using categories interface URL.
1052-
$url = '/admin/category.php?category=theme_' . $theme . PHP_EOL;
1053-
} else {
1054-
// Settings using tabs interface URL.
1055-
$url = '/admin/settings.php?section=themesetting' . $theme . PHP_EOL;
1050+
1051+
if (!file_exists($CFG->dirroot . '/mod/hvp/version.php')) { // Not compatible with mod_hvp.
1052+
if (file_exists($CFG->dirroot . '/theme/' . $theme . '/settings.php')) {
1053+
require_once($CFG->libdir . '/adminlib.php');
1054+
if (admin_get_root()->locate('theme_' . $theme)) {
1055+
// Settings use categories interface URL.
1056+
$url = '/admin/category.php?category=theme_' . $theme . PHP_EOL;
1057+
} else {
1058+
// Settings use tabs interface URL.
1059+
$url = '/admin/settings.php?section=themesetting' . $theme . PHP_EOL;
1060+
}
1061+
$menu .= '-{getstring:admin}currenttheme{/getstring}|' . $url;
10561062
}
1057-
$menu .= '-{getstring:admin}currenttheme{/getstring}|' . $url;
10581063
}
10591064
}
10601065
}

0 commit comments

Comments
 (0)