MDL-83862 question: Improve documentation of $qbank parameters

This commit is contained in:
Mark Johnson
2025-01-27 11:24:54 +00:00
parent 5b0f5d4c0c
commit bc57ced4f2
2 changed files with 14 additions and 4 deletions
+6 -3
View File
@@ -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)) {
@@ -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 {