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

fix the 'add' module page javascript failing on Moodle 4.3+ #97

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

usqfowlerj
Copy link

Checklist
  • the contributor license agreement is signed — the CLA URL is a 404 now, and I had signed it under a different github username anyway
  • commit message follows commit guidelines
  • screenshots are included showing significant UI changes — N/A
  • documentation is changed or added — N/A
Description of change

From Moodle 4.3, YUI module moodle-core_availability-form now expects to find elements with ids fitem_id_availabilityconditionsjson and availabilityconditions-loading.

From Moodle 4.3, YUI module moodle-core_availability-form now expects
to find elements with ids `fitem_id_availabilityconditionsjson` and
`availabilityconditions-loading`.
@edalex-ian
Copy link
Member

Thanks for raising this @usqfowlerj , this unfortunately fell through our review processes. We'll schedule in some review and see if we can get this in.

Copy link
Contributor

@edalex-siddharth edalex-siddharth Jan 22, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @usqfowlerj for providing a fix. I have a small suggestion for these changes to only add these elements when conditional access setting is enabled:

// When conditional access is enabled, moodle expects id_availabilityconditionsjson field, fitem_id_availabilityconditionsjson and availabilityconditions-loading in standard module form, as we don't use standard form.
 if(!empty($CFG->enableavailability)){
            echo html_writer::start_tag('form', array('style'=>'display:none'));
            echo html_writer::tag('div', '', array('id' => 'fitem_id_availabilityconditionsjson'));
            echo html_writer::tag('div', '', array('id' => 'availabilityconditions-loading'));
            echo html_writer::empty_tag('input', array('id'=>'id_availabilityconditionsjson', 'type'=>'hidden'));
            echo html_writer::end_tag('form');
            }

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.

3 participants