From c686fee65415057be2c62488bbd94863971e956e Mon Sep 17 00:00:00 2001 From: Conn Warwicker Date: Fri, 6 Dec 2024 14:05:52 +0000 Subject: [PATCH] MDL-81115 question: Question bank tag filter to use all available tags. This makes the tags which are available to the user on the question bank tag filter, use tags from all available contexts, not just that course. This means they can filter by tags assigned to system questions as well, for example. --- .../bank/tagquestion/classes/tag_condition.php | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/question/bank/tagquestion/classes/tag_condition.php b/question/bank/tagquestion/classes/tag_condition.php index 161d52e34da..11db541c5d2 100644 --- a/question/bank/tagquestion/classes/tag_condition.php +++ b/question/bank/tagquestion/classes/tag_condition.php @@ -49,20 +49,7 @@ class tag_condition extends condition { return; } parent::__construct($qbank); - $cat = $qbank->get_pagevars('cat'); - if (is_array($cat)) { - foreach ($cat as $value) { - [, $contextid] = explode(',', $value); - $catcontext = \context::instance_by_id($contextid); - $this->contexts[] = $catcontext; - } - } else { - [, $contextid] = explode(',', $qbank->get_pagevars('cat')); - $catcontext = \context::instance_by_id($contextid); - $this->contexts[] = $catcontext; - } - $thiscontext = $qbank->get_most_specific_context(); - $this->contexts[] = $thiscontext; + $this->contexts = $qbank->contexts->all(); $this->selectedtagids = $this->filter->values ?? []; }