Skip to content

Commit

Permalink
Merge pull request #74 from stopfstedt/closure_fix
Browse files Browse the repository at this point in the history
fixes scoping issue with closures by explicitly passing variable into it.
  • Loading branch information
jrjohnson authored Jan 22, 2025
2 parents 1976184 + d95118d commit 76fc540
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 3 additions & 2 deletions edit_form.php
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,8 @@ protected function definition(): void {
&$processparents,
&$learnergroupoptions,
&$grouptitle,
&$instance
&$instance,
$ilios
) {
$parentgroup = $ilios->get_learner_group($child->parent);
$instance->learnergroupid = $parentgroup->id;
Expand Down Expand Up @@ -444,7 +445,7 @@ public function definition_after_data(): void {
' ('. count($subgroup->children) .')'.
' ('. count($subgroup->users) .')';
if (!empty($subgroup->children)) {
$processchildren = function ($parent) use (&$processchildren, &$subgroupoptions) {
$processchildren = function ($parent) use (&$processchildren, &$subgroupoptions, $ilios) {
$subgrps = $ilios->get_learner_groups([ 'parent' => $parent->id], [ 'title' => "ASC"]);
foreach ($subgrps as $subgrp) {
$subgroupoptions["$subgrp->id:$parent->title / $subgrp->title"] = $parent->title.' / '.$subgrp->title.
Expand Down
2 changes: 1 addition & 1 deletion version.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

defined('MOODLE_INTERNAL') || die();

$plugin->version = 2024110101; // The current plugin version (Date: YYYYMMDDXX).
$plugin->version = 2024110102; // The current plugin version (Date: YYYYMMDDXX).
$plugin->requires = 2024041600; // Requires this Moodle version.
$plugin->component = 'enrol_ilios'; // Full name of the plugin (used for diagnostics).
$plugin->release = 'v4.4';
Expand Down

0 comments on commit 76fc540

Please sign in to comment.