forked from moodle/moodle
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MDL-83859 core_question: Update filter condition API
This corrects some definitions of the methods in the base condition class to make things more obvious to developers implementing new filters. Previously if your filter wanted to use the default `core/datafilter/filtertype` class, you still had to implement `get_filter_class` to return `null`, since it was declared as abstract. This change defines it as returning `null` by default, so this is no longer necessary. Also, this removes the default definitions for `get_condition_key` and `build_query_from_functions`, and declares them abstract. Currently it is necessary to override these to implement a functional filter so it doesn't make sense to have a useless default definition. This will not cause any breakages with existing filters. All filters must already be defining the methods that are now abstract, otherwise they will not function. Any filter that is now overriding `get_filter_class` to return `null` will continue to work as before, even though this is no longer necessary.
- Loading branch information
1 parent
a798b1d
commit c65d069
Showing
2 changed files
with
34 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
issueNumber: MDL-83859 | ||
notes: | ||
core_question: | ||
- message: > | ||
The definition of the abstract `core_question\local\bank\condition` | ||
class has changed to make it clearer which methods are required | ||
in child classes. | ||
The `get_filter_class` method is no longer declared as abstract, and | ||
will return `null` by default to use the base | ||
`core/datafilter/filtertype` class. If you have defined this method | ||
to return `null` in your own class, it will continue to work, but | ||
it is no longer necessary. | ||
`build_query_from_filter` and `get_condition_key` are now declared as | ||
abstract, since all filter condition classes must define these | ||
(as well as existing abstract methods) to function. Again, exsiting | ||
child classes will continue to work if they did before, as they | ||
already needed these methods. | ||
type: changed |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters