Problem/Motivation
Currently the operators() method on views isn't included in the base class \Drupal\views\Plugin\views\filter\FilterPluginBase nor in an interface.
I figured there wouldn't be that many filter plugins without operators so we might add the method to the base class, but it turns out there are quite a few of them
@Lendude in #3
Proposed resolution
Is it worth a followup to try and convert these to interfaces? We can implement the interface in core now, and warn users that implement the method without the interface that they will have to add the interface for Drupal 11?
@longwave in #4
I think the interface idea is fantastic.
@alexpott in #5
| Comment | File | Size | Author |
|---|
Issue fork drupal-3320569
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
- 3320569-fix-views-plugins
changes, plain diff MR !4250
Comments
Comment #2
mondrakeComment #3
lendudeI figured there wouldn't be that many filter plugins without operators so we might add the method to the base class, but it turns out there are quite a few of them so checking for the method sounds like the best way to do this.
Comment #4
longwaveIs it worth a followup to try and convert these to interfaces? We can implement the interface in core now, and warn users that implement the method without the interface that they will have to add the interface for Drupal 11?
Comment #5
alexpottI think the interface idea is fantastic. I think we should do that here rather than in a follow up as this issue on it's own doesn't really improve too much.
Would become
Comment #6
akram khanAddress #5 and Updated Patch
Comment #7
akram khantry to fix
Comment #8
nitin shrivastava commentedtry to fix #7
Comment #9
nitin shrivastava commentedtry to fix #8
Comment #10
nitin shrivastava commentedremoved CCF error.
Comment #11
smustgrave commentedThe last patch doesn't pass commit checks, could you make sure to run
./core/scripts/dev/commit-code-check.shbefore uploading a patch to make sure there are no issues with code formatting. see https://www.drupal.org/docs/develop/development-tools/running-core-devel...Also please include an interdiff
Comment #14
spokjeRerolled 3320569-2.patch against 11.x in new MR.
All patches after that show that c/p-ing rough example code isn't really helping, not even when tried repeatedly.
Comment #15
spokjeComment #17
spokjeComment #18
spokjeComment #19
spokjeComment #20
spokjeComment #21
spokjeUpdated IS and MR and added draft CR.
That's enough two-lettered capitalized words for me to put it on NR.
Comment #22
spokjeComment #23
spokjeComment #24
smustgrave commentedCR reads well, IS is clear and matches MR.
So I believe this is OK.
Couldn't think of anyone two letter word to use haha.
Comment #25
longwaveAdded some feedback on the MR. Maybe we should split this into two issues.
Comment #26
spokjeResolved all threads.
Comment #27
smustgrave commented2 small nitpicky stuff.
Rest looks fine though
Probably good to self RTBC after those 2.
Comment #28
spokjeNot a big fan os self-RTBCing (read: I hate it), but we need @longwave to enlighten us no matter what.
Comment #29
quietone commentedI'm triaging RTBC issues. I read the IS, the comments and MR. I didn't find any unanswered questions or other work to do.
The change record does need to be updated. It should state that using the operator method without the interface will throw an exception in Drupal 11.
Comment #30
quietone commentedAnd the title of the CR could be more specific about where the operators method is used. Perhaps this is better, "Classes using operators() when extending \Drupal\views\Plugin\views\filter\FilterPluginBase must implement FilterOperatorsInterface'?
Comment #31
spokjeThanks @quietone, updated CR.
Comment #35
catchI updated the deprecation to throwing an exception in 12.0.0 instead of 11.0.0, otherwise looks great. Committed/pushed to 11.x and cherry-picked to 10.3.x, thanks!