Skip to content

Commit

Permalink
Fixed compatibility with mod_hvp.
Browse files Browse the repository at this point in the history
  • Loading branch information
michael-milette committed Sep 30, 2024
1 parent 8c1f22b commit 83c4f53
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 18 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ All notable changes to this project will be documented in this file.
- New {mygroupings} tag.
### Updated
- Link to External LTI now only available in Moodle 4.3+.
- Addressed compatibility issue with mod_hvp that prevents link to current theme settings from working.
- Refactoring in preparations for Moodle 4.5.
- Added more documentation to README.md.
- Fixed links and updated table of contents in README.md.
Expand Down
41 changes: 23 additions & 18 deletions classes/text_filter.php
Original file line number Diff line number Diff line change
Expand Up @@ -887,16 +887,18 @@ private function generatortags(&$text) {
$menu .= '-{getstring}site{/getstring}: {getstring:admin}' . $label . '{/getstring}|/admin/settings.php' .
'?section=' . $section . '|Including custom menus, designer mode, theme in URL' . PHP_EOL;

if (file_exists($CFG->dirroot . '/theme/' . $theme . '/settings.php')) {
require_once($CFG->libdir . '/adminlib.php');
if (admin_get_root()->locate('theme_' . $theme)) {
// Settings use categories interface URL.
$url = '/admin/category.php?category=theme_' . $theme . PHP_EOL;
} else {
// Settings use tabs interface URL.
$url = '/admin/settings.php?section=themesetting' . $theme . PHP_EOL;
if (!file_exists($CFG->dirroot . '/mod/hvp/version.php')) { // Not compatible with mod_hvp.
if (file_exists($CFG->dirroot . '/theme/' . $theme . '/settings.php')) {
require_once($CFG->libdir . '/adminlib.php');
if (admin_get_root()->locate('theme_' . $theme)) {
// Settings use categories interface URL.
$url = '/admin/category.php?category=theme_' . $theme . PHP_EOL;
} else {
// Settings use tabs interface URL.
$url = '/admin/settings.php?section=themesetting' . $theme . PHP_EOL;
}
$menu .= '-{getstring}site{/getstring}: {getstring:admin}currenttheme{/getstring}|' . $url;
}
$menu .= '-{getstring}site{/getstring}: {getstring:admin}currenttheme{/getstring}|' . $url;
}
$menu .= '-{getstring}site{/getstring}: {getstring}notifications{/getstring} ({getstring}admin{/getstring})' .
'|/admin/index.php' . PHP_EOL;
Expand Down Expand Up @@ -1045,16 +1047,19 @@ private function generatortags(&$text) {
$menu .= '-###' . PHP_EOL;
$menu .= '-{getstring:admin}' . $label . '{/getstring}|/admin/settings.php' .
'?section=' . $section . '|Including custom menus, designer mode, theme in URL' . PHP_EOL;
if (file_exists($CFG->dirroot . '/theme/' . $theme . '/settings.php')) {
require_once($CFG->libdir . '/adminlib.php');
if (admin_get_root()->locate('theme_' . $theme)) {
// Settings using categories interface URL.
$url = '/admin/category.php?category=theme_' . $theme . PHP_EOL;
} else {
// Settings using tabs interface URL.
$url = '/admin/settings.php?section=themesetting' . $theme . PHP_EOL;

if (!file_exists($CFG->dirroot . '/mod/hvp/version.php')) { // Not compatible with mod_hvp.
if (file_exists($CFG->dirroot . '/theme/' . $theme . '/settings.php')) {
require_once($CFG->libdir . '/adminlib.php');
if (admin_get_root()->locate('theme_' . $theme)) {
// Settings use categories interface URL.
$url = '/admin/category.php?category=theme_' . $theme . PHP_EOL;
} else {
// Settings use tabs interface URL.
$url = '/admin/settings.php?section=themesetting' . $theme . PHP_EOL;
}
$menu .= '-{getstring:admin}currenttheme{/getstring}|' . $url;
}
$menu .= '-{getstring:admin}currenttheme{/getstring}|' . $url;
}
}
}
Expand Down

0 comments on commit 83c4f53

Please sign in to comment.