moodle-an-hochschulen / moodle-local_boostnavigation

Moodle plugin which tries to overcome some fixed appearance behaviours of Boost's nav drawer in a clean way
GNU General Public License v3.0
39 stars 27 forks source link

Bug: Plugin should probably prevent manipulating the boost navigation on non-Boost themes #90

Closed danowar2k closed 2 years ago

danowar2k commented 3 years ago

This is an older issue as we finally drop support for a Clean-based theme we were using.

You don't check whether the current theme is a Boost based theme before manipulating it. This led to missing nodes when using a Clean based theme.

I'll just paste a "fix" for this here

lib.php:

function local_boostnavigation_extend_navigation(global_navigation $navigation) {
    global $CFG, $PAGE, $COURSE;

    // do not mess with navigation on non-Boost themes
    $isBoostBasedTheme = $PAGE->theme->name == "boost" || in_array("boost", $PAGE->theme->parents);
    if (!$isBoostBasedTheme) return;

    // Fetch config.
    $config = get_config('local_boostnavigation');

lib.php, second part:

function local_boostnavigation_extend_navigation_course(navigation_node $navigation) {
    global $PAGE, $COURSE;

    // do not mess with navigation on non-Boost themes
    $isBoostBasedTheme = $PAGE->theme->name == "boost" || in_array("boost", $PAGE->theme->parents);
    if (!$isBoostBasedTheme) return;

    // Fetch config.
    $config = get_config('local_boostnavigation');
danowar2k commented 3 years ago

We've just encountered a problem with the content bank in Moodle 3.9.7. On that page something with $PAGE hasn't been done yet that is necessary before we are allowed to access $PAGE->theme . Therefore the above approach leads to a error on that page.

The question would be is there an error on that page (contentbank/index.php) or are we doing stuff that we shouldn't be doing...

danowar2k commented 2 years ago

Well, I'm gonna close this because it is not relevant to us anymore.