MDL-70911 core_badges: Remove $CFG->badges_site_backpack

The $CFG->badges_site_backpack setting has been completely removed
because it's not required anymore. From now, the primary site
backpack will be the first one in the "Manage backpacks" list (so,
the one with lower sortorder value).
This commit is contained in:
Sara Arjona 2021-02-17 16:33:20 +01:00
parent 066e998400
commit 49c1d41a60
13 changed files with 74 additions and 56 deletions

View file

@ -78,7 +78,8 @@ class backpack extends external_backpack {
}
$mform->addElement('select', 'externalbackpackid', get_string('backpackprovider', 'badges'), $choices);
$mform->setType('externalbackpackid', PARAM_INT);
$mform->setDefault('externalbackpackid', $CFG->badges_site_backpack);
$defaultbackpack = badges_get_site_primary_backpack();
$mform->setDefault('externalbackpackid', $defaultbackpack->id);
$mform->hideIf('password', 'externalbackpackid', 'in', $restrictedoptions);
$mform->hideIf('backpackemail', 'externalbackpackid', 'in', $restrictedoptions);

View file

@ -56,7 +56,7 @@ class external_backpacks_page implements \renderable {
* @return stdClass
*/
public function export_for_template(\renderer_base $output) {
global $CFG, $PAGE;
global $PAGE;
$PAGE->requires->js_call_amd('core_badges/backpackactions', 'init');
@ -71,7 +71,6 @@ class external_backpacks_page implements \renderable {
$exporter = new backpack_exporter($backpack);
$backpack = $exporter->export($output);
$backpack->cantest = ($backpack->apiversion == OPEN_BADGES_V2);
$backpack->iscurrent = ($backpack->id == $CFG->badges_site_backpack);
$backpack->canmoveup = $rownumber > 0;
$backpack->canmovedown = $rownumber < $rowcount - 1;