Skip to content

Commit 547101f

Browse files
committed
fixup! Add question bank filter API guide
Add explanation of plugin_feature requirements
1 parent 888b2b5 commit 547101f

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

docs/apis/plugintypes/qbank/filters.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,21 @@ class myfilter_condition extends condition {
4747
}
4848
```
4949

50-
Define the `get_name()` method, which returns the label displayed in the filter UI.
50+
Modify your `plugin_feature` class to return an instance of your condition from the `get_question_filters()` method:
51+
52+
```php title="question/bank/myplugin/classes/plugin_feature.php"
53+
namespace qbank_myplugin;
54+
55+
class plugin_feature extends core_question\local\bank\plugin_features_base {
56+
public function get_question_filters(?core_question\local\bank\view $qbank = null): array {
57+
return [
58+
new myfilter_condition($qbank),
59+
];
60+
}
61+
}
62+
```
63+
64+
Back in your `condition` class, define the `get_name()` method, which returns the label displayed in the filter UI.
5165

5266
```php title="Define the condition name"
5367
public function get_name(): string {

0 commit comments

Comments
 (0)