diff --git a/question/classes/local/bank/condition.php b/question/classes/local/bank/condition.php index 549446a1d52..4ad66b53a72 100644 --- a/question/classes/local/bank/condition.php +++ b/question/classes/local/bank/condition.php @@ -59,11 +59,14 @@ abstract class condition { } /** - * Extract the required filter from the provided question bank view. + * Extract the required filter from the provided question bank view and set the initial values. * - * This will look for the filter matching {@see get_condition_key()} + * This will look for the filter matching {@see get_condition_key()} in the view's current filter parameter. + * If the filter is not being initialised to display the question bank UI (for example, to resolve a list of questions matching + * a set of filters), then the `$qbank` argument may be null, and any usage of it to set the initial filter state is skipped. * - * @param view|null $qbank + * @param ?view $qbank The question bank view the filter is being rendered for. This may only be used for setting the + * initial state of the filter. */ public function __construct(?view $qbank = null) { if (is_null($qbank)) { diff --git a/question/classes/local/bank/plugin_features_base.php b/question/classes/local/bank/plugin_features_base.php index cdb24ed23c6..3644bcc5344 100644 --- a/question/classes/local/bank/plugin_features_base.php +++ b/question/classes/local/bank/plugin_features_base.php @@ -109,7 +109,14 @@ class plugin_features_base { /** * Return search conditions for the plugin. * - * @param view|null $qbank + * This is used by question bank view classes to get the list of available filters to display in the filter UI. + * + * This is also used to get the list of available filters for other purposes, for example resolving the list of questions + * selected by a set of filters, in which case the `$qbank` argument may be `null` + * {@see filter_condition_manager::get_condition_classes()}. + * + * @param view|null $qbank The current question bank view the filters are being rendered for, for example the main question + * bank page, or the random question view. * @return condition[] */ public function get_question_filters(?view $qbank = null): array {