Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MBS-8819: Show action menu when loading course modules via ajax #171

Merged
merged 1 commit into from
May 9, 2024

Conversation

sh-csg
Copy link
Contributor

@sh-csg sh-csg commented Feb 20, 2024

This shows action menu when course module is rendered again after changing sth (e.g. indentation). This closes #169 .

@sh-csg
Copy link
Contributor Author

sh-csg commented Feb 21, 2024

(failing CI is not related to the patch)

@sh-csg
Copy link
Contributor Author

sh-csg commented Feb 21, 2024

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"):

if (!in_array($PAGE->pagetype, $pagesavailable)) {

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.

@PhMemmel
Copy link

Can confirm this patch works, but the issue described by @sh-csg should be fixed in the course format in a cleaner way.

@izendegi
Copy link
Contributor

izendegi commented May 8, 2024

Hi,

We've applied this patch and it fixes the issue.

@davidherney davidherney merged commit 126a88f into davidherney:master May 9, 2024
0 of 3 checks passed
@davidherney
Copy link
Owner

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Edit Buttons Disappearing
4 participants