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.
This commit is contained in:
Conn Warwicker
2024-12-06 14:16:26 +00:00
parent 4bd3217ce8
commit c686fee654
@@ -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 ?? [];
}