moodle-format_onetopic
moodle-format_onetopic copied to clipboard
MBS-8819: Show action menu when loading course modules via ajax
This shows action menu when course module is rendered again after changing sth (e.g. indentation). This closes #169 .
(failing CI is not related to the patch)
Some details about the patch:
The problem arises as $PAGE->_pagetype is not set when the constructor is called for the handling of the get_fragment() call. When $PAGE->pagetype is accessed the first time (lib.php, L140), moodle_page::magic_get_pagetype() calls moodle_page::initialise_default_pagetype() where pagetype is set to "lib-ajax-service" (out of "/lib/ajax/service.php"): https://github.com/davidherney/moodle-format_onetopic/blob/6c6950b531df56fc8fafc43176f05ffc996c5d86/lib.php#L140
Other course formats don't access $PAGE->pagetype that early, so they get to L408 in /lib/external/externallib.php:
https://github.com/moodle/moodle/blob/d3ad77e4762ee5b96a3fecb51158c6039202f39e/lib/external/externallib.php#L408
$PAGE->set_url() sets the pagetype to "site-index" in this case.
Can confirm this patch works, but the issue described by @sh-csg should be fixed in the course format in a cleaner way.
Hi,
We've applied this patch and it fixes the issue.
Hi...
Thanks @sh-csg, I've integrated the fix.
@PhMemmel If you have an idea on how to do it better, tell me and I'll review it.
Saludos