Using Availability API to add new grouping restrictions

Using Availability API to add new grouping restrictions

by Rex Lorenzo -
Number of replies: 0

I am trying to figure out how to use the Availability API to programmatically add new grouping restrictions for course modules in a course, but cannot find any clear code examples of how to add a new grouping condition to an existing course module.

I have been reading https://docs.moodle.org/dev/Availability_API_for_items_within_a_module but it is assuming that the grouping setup is done via the Moodle course module form.

I also read https://docs.moodle.org/dev/Availability_API#Using_the_API but that is mainly about how to use the API to check if a user has access.

I checked the PHPunit test (https://github.com/moodle/moodle/blob/master/availability/condition/grouping/tests/condition_test.php), but I just see the condition as being standalone and don't see how that condition is added to a course module.

Any help or place to get a good example?

Average of ratings: -