Hello everyone!
An integral part of our moodle installation is the ability for users to select a cohort in the registry. The cohorts can be selected using the dropdown in the registration form.
However, the website needs to be available in multiple languages so we have to translate the dropdown content. Using Multi-Lang filters like {mlang en} causes problems because the dropdown data must be exported for further usage (the export has to be in English).
Is it possible to pull the cohort names from the cohort lists instead? The dropdown would contain the cohort names in their respective languages, but we would refer to the English name in the export file. Is the function cohort_get_available_cohorts() getting the data we need? The function requires a context-ID - how/where can I get the correct context-ID?
I've put the code snippet below. The profile field company_classification is the dropdown field.
$classificationField = $mform->getElement('profile_field_company_classification'); $classificationField->removeOptions(); require_once($CFG->dirroot . '/cohort/lib.php'); $cohorts = cohort_get_available_cohorts($PAGE->context);