From 683fc4d9d18e607f90a9a8844095bfaec27a9e65 Mon Sep 17 00:00:00 2001 From: Paul Holden Date: Tue, 8 Feb 2022 16:35:59 +0000 Subject: [PATCH] MDL-73811 reportbuilder: ensure audience cards are uniquely keyed. --- reportbuilder/classes/local/helpers/audience.php | 2 ++ reportbuilder/templates/local/sidebar-menu/card.mustache | 1 + 2 files changed, 3 insertions(+) diff --git a/reportbuilder/classes/local/helpers/audience.php b/reportbuilder/classes/local/helpers/audience.php index d8bcf2c8335..9473548b450 100644 --- a/reportbuilder/classes/local/helpers/audience.php +++ b/reportbuilder/classes/local/helpers/audience.php @@ -214,9 +214,11 @@ class audience { $notavailablestr = get_string('notavailable', 'moodle'); $audiencetypes = self::get_audience_types(); + $audiencetypeindex = 0; foreach ($audiencetypes as $categoryname => $audience) { $menucards = [ 'name' => $categoryname, + 'key' => 'index' . ++$audiencetypeindex, ]; foreach ($audience as $classname => $name) { diff --git a/reportbuilder/templates/local/sidebar-menu/card.mustache b/reportbuilder/templates/local/sidebar-menu/card.mustache index ee34a5fcd8e..f27e75859a1 100644 --- a/reportbuilder/templates/local/sidebar-menu/card.mustache +++ b/reportbuilder/templates/local/sidebar-menu/card.mustache @@ -22,6 +22,7 @@ Example context (json): { "name": "General", + "key": "general", "items": [{ "name": "Manually added users", "identifier": "core_reportbuilder:users"